{"record":{"id":"72dbb9a51c90a328","repo":"oxc-project/oxc","slug":"word-is-not-allowed-in-test-title","errorCode":null,"errorMessage":"{word} is not allowed in test title","messagePattern":"(.+?) is not allowed in test title","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/shared/jest_vitest/valid_title.rs","lineNumber":48,"sourceCode":"    OxcDiagnostic::warn(\"Should not have an empty title\")\n        .with_help(\"Write a meaningful title for your test\")\n        .with_label(span)\n}\n\nfn duplicate_prefix_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Should not have duplicate prefix\")\n        .with_help(\"The function name already has the prefix, try to remove the duplicate prefix\")\n        .with_label(span)\n}\n\nfn accidental_space_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Should not have leading or trailing spaces\")\n        .with_help(\"Remove the leading or trailing spaces\")\n        .with_label(span)\n}\n\nfn disallowed_word_diagnostic(word: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"{word} is not allowed in test title\"))\n        .with_help(\"It is included in the `disallowedWords` of your config file, try to remove it from your title\")\n        .with_label(span)\n}\n\npub fn must_match_diagnostic(message: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(message.to_string())\n        .with_help(\"Make sure the title matches the `mustMatch` of your config file\")\n        .with_label(span)\n}\n\npub fn must_not_match_diagnostic(message: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(message.to_string())\n        .with_help(\"Make sure the title does not match the `mustNotMatch` of your config file\")\n        .with_label(span)\n}\n\npub const DOCUMENTATION: &str = r\"\n### What it does","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/shared/jest_vitest/valid_title.rs#L30-L66","documentation":"Diagnostic from the shared jest/vitest `valid-title` rule (disallowed_word_diagnostic). It fires when a test title contains a word listed in the rule's `disallowedWords` config option. Teams use it to ban vague words like 'correct', 'properly', or 'should' that make titles uninformative.","triggerScenarios":"Configure `{ \"valid-title\": [\"error\", { \"disallowedWords\": [\"correct\", \"properly\"] }] }`; any title containing one of those substrings, e.g. `it('works correctly', fn)`, triggers `{word} is not allowed in test title` with help text pointing at the config.","commonSituations":"Adopting a title-style guide and enforcing it via lint; inherited suites full of 'works correctly'/'handles it properly' titles after the word list is enabled.","solutions":["Rewrite the title to describe observable behavior: `it('returns sorted rows', fn)` instead of 'sorts correctly'.","Remove the word from `disallowedWords` if it was banned by mistake.","Keep the word but out of the title (in comments) if the title cannot avoid it — the rule only inspects titles."],"exampleFix":"// before\n// config: \"valid-title\": [\"error\", { \"disallowedWords\": [\"correctly\"] }]\nit('calculates correctly', () => { /* ... */ });\n\n// after\nit('returns the sum of its arguments', () => { /* ... */ });","handlingStrategy":"validation","validationCode":"const disallowed = ['correctly', 'properly']; // mirror the oxlint config\nfor (const [fn, title] of collectTestCalls(src)) {\n  const hit = disallowed.find(w => title.includes(w));\n  if (hit) console.warn(`'${hit}' not allowed in title: ${title}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Encode the word ban in shared lint config so editors and CI agree.","Prefer describing observable outcomes ('returns 404') over quality adverbs ('works correctly').","Keep the disallowedWords list short and reviewed — long lists rot into false positives."],"tags":["jest","vitest","oxlint","testing","test-title","naming","config","valid-title"],"backgroundTag":"invalid-test-title","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}