no-commented-out-tests
Configuration
Rule Details
Disallow commenting out Jest tests. Reviewers often skim past comments, so disabled cases can sit in the tree indefinitely. Prefer removing dead tests, extracting helpers, or using .skip / test.todo when you need an explicit, auditable signal. This is the comment-side complement to jest/no-disabled-tests, which reports skip / only / todo on real call sites instead of commented-out text.
rslint walks each comment body line by line: the slice after //, or the text inside /* … */. If any line matches the eslint-plugin-jest-style heuristic—optional x or f prefix (xit, fit, …), then test, it, or describe, optional dot- or bracket-member chains (e.g. .skip, .only, .concurrent, ['skip']), then optional whitespace and (—it reports the entire comment range with the message “Do not comment out tests”.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Limitations
Matching is based on the literal shape of test API names inside comment text, not on full parsing of the commented code. It will not flag indirect or renamed patterns, for example:
Because the heuristic treats any test / it / describe-like call opening inside a comment as suspicious, a comment that merely mentions that shape (for example documenting an API) can be reported; prefer rephrasing such comments or using examples that do not mirror a call form.