oxc-project/oxc · warning · OxcDiagnostic
{word} is not allowed in test title
Error message
{word} is not allowed in test title What it means
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.
Source
Thrown at crates/oxc_linter/src/rules/shared/jest_vitest/valid_title.rs:48
OxcDiagnostic::warn("Should not have an empty title")
.with_help("Write a meaningful title for your test")
.with_label(span)
}
fn duplicate_prefix_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Should not have duplicate prefix")
.with_help("The function name already has the prefix, try to remove the duplicate prefix")
.with_label(span)
}
fn accidental_space_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Should not have leading or trailing spaces")
.with_help("Remove the leading or trailing spaces")
.with_label(span)
}
fn disallowed_word_diagnostic(word: &str, span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("{word} is not allowed in test title"))
.with_help("It is included in the `disallowedWords` of your config file, try to remove it from your title")
.with_label(span)
}
pub fn must_match_diagnostic(message: &str, span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(message.to_string())
.with_help("Make sure the title matches the `mustMatch` of your config file")
.with_label(span)
}
pub fn must_not_match_diagnostic(message: &str, span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(message.to_string())
.with_help("Make sure the title does not match the `mustNotMatch` of your config file")
.with_label(span)
}
pub const DOCUMENTATION: &str = r"
### What it doesView on GitHub (pinned to e1e7af627c)
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.
Example fix
// before
// config: "valid-title": ["error", { "disallowedWords": ["correctly"] }]
it('calculates correctly', () => { /* ... */ });
// after
it('returns the sum of its arguments', () => { /* ... */ }); Defensive patterns
Strategy: validation
Validate before calling
const disallowed = ['correctly', 'properly']; // mirror the oxlint config
for (const [fn, title] of collectTestCalls(src)) {
const hit = disallowed.find(w => title.includes(w));
if (hit) console.warn(`'${hit}' not allowed in title: ${title}`);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {un_prefixed_name} should match {raw_pattern}
- {un_prefixed_name} should not match {raw_pattern}
- Should not have duplicate prefix
- Title must be a string
- Should not have an empty title
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/72dbb9a51c90a328.
Report an issue: GitHub.