{"record":{"id":"1ca4bec5e01a98c7","repo":"oxc-project/oxc","slug":"enforce-lowercase-test-names","errorCode":null,"errorMessage":"Enforce lowercase test names","messagePattern":"Enforce lowercase test names","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/shared/jest_vitest/prefer_lowercase_title.rs","lineNumber":17,"sourceCode":"use oxc_ast::{AstKind, ast::Argument};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_span::Span;\nuse oxc_str::CompactStr;\nuse schemars::JsonSchema;\nuse serde::Deserialize;\n\nuse crate::{\n    context::LintContext,\n    rule::DefaultRuleConfig,\n    utils::{\n        JestFnKind, JestGeneralFnKind, ParsedJestFnCallNew, PossibleJestNode, parse_jest_fn_call,\n    },\n};\n\nfn prefer_lowercase_title_diagnostic(title: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Enforce lowercase test names\")\n        .with_help(format!(\"`{title:?}`s should begin with lowercase\"))\n        .with_label(span)\n}\n\npub const DOCUMENTATION: &str = r\"### What it does\n\nEnforce `it`, `test`, `describe`, and `bench` to have descriptions that begin with a\nlowercase letter. This provides more readable test failures.\n\n### Why is this bad?\n\nLowercase messages for test failures generally result in more grammatically correct\nfailure messages when you have a test failure.\n\n### Examples\n\nExamples of **incorrect** code for this rule:\n```javascript","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/shared/jest_vitest/prefer_lowercase_title.rs#L1-L35","documentation":"This is the oxlint `prefer-lowercase-title` rule (jest/vitest plugin). It enforces that the first letter of `it`/`test`/`describe`/`bench` titles is lowercase, which keeps generated failure sentences grammatical ('adds two numbers' vs 'Adds two numbers'). The diagnostic includes the offending title and points at the title argument span.","triggerScenarios":"A title string literal passed to a test/describe/bench call whose first alphabetic character is uppercase — e.g. `it('Returns 404', ...)` — and not exempted by the rule's configuration.","commonSituations":"Teams writing titles as short sentences with a capital first word; porting tests from frameworks that capitalize titles; mixing conventions after a merge. Config knobs (allowedPrefixes, ignore, ignoreTopLevelDescribe in the ESLint original / schema-driven options here) let teams carve out exceptions.","solutions":["Lowercase the first letter of the title: `it('returns 404', ...)`.","For titles that must start with a proper noun/acronym (e.g. 'HTTP ...'), add it to the rule's allowed prefixes option.","If your team standard is capitalized titles, turn this rule off in .oxlintrc.json rather than fighting it file by file."],"exampleFix":"// before\ndescribe('UserApi', () => {\n  it('Returns 404 for missing user', () => { /* ... */ });\n});\n\n// after\ndescribe('userApi', () => {\n  it('returns 404 for missing user', () => { /* ... */ });\n});","handlingStrategy":"validation","validationCode":"// .oxlintrc.json\n{\n  \"rules\": {\n    \"jest/prefer-lowercase-title\": [\"error\", { \"allowedPrefixes\": [\"HTTP\", \"GET\", \"POST\"] }]\n  }\n}\n\nnpx oxlint tests/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write titles as lowercase predicate phrases ('returns 404 when user missing').","Add unavoidable proper nouns/acronyms to allowedPrefixes instead of disabling the rule.","If the team prefers capitalized titles, disable the rule globally once — not per-file."],"tags":["jest","vitest","oxlint","testing","naming-conventions","style","static-analysis"],"backgroundTag":"test-naming-convention","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}