Test named after a ticket
Test named after a ticket. The test is named after a ticket or a review round, not the behavior it checks.
This is how the comment reads inline, under the flagged line.
Why it matters
'fixes bug 1234' tells the next reader nothing when it fails. The name should say what must stay true.
What to do
Name the behavior: 'rejects an empty title'.
Examples
it("fixes bug 1234", () => {it("rejects an empty title", () => {What it catches
It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript, Python. Scope: Test files only. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
it("fixes bug 1234", () => { expect(1).toBe(1); });Left alone
it("rejects an empty name", () => { expect(1).toBe(1); });Research
Tests named after a ticket, bug number or review round. The name says nothing once the round is over.
- skill: code-review
- owner's notes
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"test-named-for-history"
],
"severity": {
"test-named-for-history": "medium"
}
}
}