jest/no-test-prefixes Style
What it does
Require using .only and .skip over f and x.
Why is this bad?
Jest allows you to choose how you want to define focused and skipped tests, with multiple permutations for each:
- only & skip: it.only, test.only, describe.only, it.skip, test.skip, describe.skip.
- 'f' & 'x': fit, fdescribe, xit, xtest, xdescribe.
This rule enforces usages from the only & skip list.
Examples
Examples of incorrect code for this rule:
javascript
fit("foo"); // invalid
fdescribe("foo"); // invalid
xit("foo"); // invalid
xtest("foo"); // invalid
xdescribe("foo"); // invalidThis rule is compatible with eslint-plugin-vitest, to use it, add the following configuration to your .eslintrc.json:
json
{
"rules": {
"vitest/no-test-prefixes": "error"
}
}How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny jest/no-test-prefixes --jest-pluginjson
{
"plugins": ["jest"],
"rules": {
"jest/no-test-prefixes": "error"
}
}