📝 Disallow focused tests.
💼recommended config. This rule warns in the 🌐 all config.
🔧 This rule is automatically fixable by the --fix CLI option.
Examples of incorrect code for this rule:
it.only('test', () => {
// ...
})
test.only('it', () => {
// ...
})Examples of correct code for this rule:
it('test', () => {
// ...
})
test('it', () => {
/* ... */
})| Name | Description | Type |
|---|---|---|
fixable |
Whether the rule should provide an autofix. | Boolean |
This rule has a fixable option that tells the plugin to automatically fix the tests for you. The option is enabled by default. You can disable it in your eslint.config.js file using the following configuration.
import vitest from 'eslint-plugin-vitest'
export default [
{
files: ['**/*.ts', '**/*.js'], // or any other pattern
plugins: {
vitest,
},
rules: {
...vitest.configs.recommended.all,
'vitest/no-focused-tests': ['error', { fixable: false }],
},
},
]