Focused test
This is how the comment reads inline, under the flagged line.
Why it matters
A committed .only turns a whole suite green by not running it.
What to do
Remove .only.
Examples
it.only("saves", () => {});it("saves", () => {});What it catches
It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript. 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.only("a", () => { expect(1).toBe(1); });Left alone
it("a", () => { expect(1).toBe(1); });Research
`.only`, `fit`, `fdescribe`. A focused test silently turns off every other test in the file.
- Reward hacking in coding agents (arXiv)
- skill: ci-integrity-audit
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"focused-test"
],
"severity": {
"focused-test": "low"
}
}
}
it.onlyruns only this test. Every other test in the file is silently skipped.