{"record":{"id":"b136258060541e95","repo":"oxc-project/oxc","slug":"some-tests-appear-to-be-inside-comments","errorCode":null,"errorMessage":"Some tests appear to be inside comments.","messagePattern":"Some tests appear to be inside comments\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/shared/jest_vitest/no_commented_out_tests.rs","lineNumber":8,"sourceCode":"use memchr::memchr3_iter;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_span::Span;\n\nuse crate::context::LintContext;\n\nfn no_commented_out_tests_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Some tests appear to be inside comments.\")\n        .with_help(\"Remove or uncomment this test.\")\n        .with_label(span)\n}\n\npub const DOCUMENTATION: &str = r\"### What it does\n\nThis rule raises a warning about commented-out tests. It's similar to the\n`no-disabled-tests` rule.\n\n### Why is this bad?\n\nYou may forget to uncomment some tests. This rule raises a warning about commented-out tests.\n\nIt is generally better to skip a test if it's flaky, or remove it if it's no longer needed.\n\n### Examples\n\nExamples of **incorrect** code for this rule:","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/shared/jest_vitest/no_commented_out_tests.rs#L1-L26","documentation":"Diagnostic from the oxlint rule `jest/no-commented-out-tests` (shared with vitest) in crates/oxc_linter/src/rules/shared/jest_vitest/no_commented_out_tests.rs:8. The rule scans comments (byte-level via memchr) for test-like content such as `it(`, `test(`, or `describe(` and reports the comment span. Commented-out tests rot silently and are easily forgotten, so the linter asks you to delete or restore them.","triggerScenarios":"A line or block comment whose text contains a call that looks like a test: `// it('works', () => {...})`, `// test('foo')`, `/* describe('suite', ...) */`. The diagnostic is raised on the comment span itself, not on any parsed AST node.","commonSituations":"Temporarily disabling a failing test before a deadline; committing WIP with commented tests; refactors where old tests were commented rather than deleted; code review comments quoting test code above a real test.","solutions":["Uncomment the test and make it pass, or delete it entirely (git history preserves it)","If the test must stay disabled temporarily, convert it to test.todo('...') which is explicit and tracked","If the flagged comment is prose (e.g. a review note quoting a test), reword it so it does not start with a bare it(/test(/describe( call pattern"],"exampleFix":"// before\n// it('adds numbers', () => {\n//   expect(add(1, 2)).toBe(3);\n// });\n\n// after\nit('adds numbers', () => {\n  expect(add(1, 2)).toBe(3);\n});\n// or, if not ready: test.todo('adds numbers');","handlingStrategy":"validation","validationCode":"rg -n \"//.*(\\bit\\(|\\btest\\(|\\bdescribe\\()\" tests/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer it.todo / test.todo over commenting tests out","Delete rather than comment: git history keeps the old code","Keep review notes from starting with a bare it( or test( at comment start"],"tags":["jest","vitest","oxlint","testing","comments","dead-code"],"backgroundTag":"commented-out-code","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"}