{"record":{"id":"5b21eea9801ae892","repo":"oxc-project/oxc","slug":"test-title-is-used-multiple-times-in-the-same-desc","errorCode":null,"errorMessage":"Test title is used multiple times in the same describe block.","messagePattern":"Test title is used multiple times in the same describe block\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/shared/jest_vitest/no_identical_title.rs","lineNumber":26,"sourceCode":"use rustc_hash::FxHashMap;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    utils::{\n        JestFnKind, JestGeneralFnKind, PossibleJestNode, collect_possible_jest_call_node,\n        parse_general_jest_fn_call,\n    },\n};\n\nfn describe_repeat(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Describe block title is used multiple times in the same describe block.\")\n        .with_help(\"Change the title of describe block.\")\n        .with_label(span)\n}\n\nfn test_repeat(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Test title is used multiple times in the same describe block.\")\n        .with_help(\"Change the title of test.\")\n        .with_label(span)\n}\n\npub const DOCUMENTATION: &str = r\"### What it does\n\nThis rule looks at the title of every test and test suite.\nIt will report when two test suites or two test cases at the same level of a test suite have the same title.\n\n### Why is this bad?\n\nHaving identical titles for two different tests or test suites may create confusion.\nFor example, when a test with the same title as another test in the same test suite fails, it is harder to know which one failed and thus harder to fix.\n\n### Examples\n\nExamples of **incorrect** code for this rule:\n```javascript","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/shared/jest_vitest/no_identical_title.rs#L8-L44","documentation":"The test variant of oxlint rule `jest/no-identical-title` (shared with vitest), the test_repeat constructor at crates/oxc_linter/src/rules/shared/jest_vitest/no_identical_title.rs:27. Two test cases (it/test) at the same describe level must not share a title, because identical names make failures in the report ambiguous. Sibling uniqueness, not global uniqueness, is what is checked.","triggerScenarios":"Two or more it()/test() calls with the same string-literal title under the same parent describe (e.g. two `it('works')` siblings). Titles in different describes may repeat freely; the duplicate sibling is reported at its span.","commonSituations":"Copy-paste tests with the name left unchanged; loops that generate tests with a constant title instead of interpolating the case; suites grown organically where names drifted into collisions; reporters that then show indistinguishable failure entries.","solutions":["Rename the later test to describe the specific behavior it verifies","When generating tests in a loop, interpolate the case into the title (it(`handles ${input}`))","Delete one test if the duplicate is a true copy testing nothing new"],"exampleFix":"// before\nit('saves the form', fn1);\nit('saves the form', fn2);\n\n// after\nit('saves the form', fn1);\nit('saves the form and notifies', fn2);","handlingStrategy":"validation","validationCode":"npx oxlint -c .oxlintrc.json tests/ # jest/no-identical-title reports sibling tests sharing a title","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In generated loops, always interpolate the case into the title","Write titles as behavior statements ('saves and notifies') so collisions are rare","Delete true duplicate tests rather than keeping both"],"tags":["jest","vitest","oxlint","testing","titles","duplicates"],"backgroundTag":"duplicate-test-title","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"}