src/content/docs/linter/rules/no-focused-tests.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> ## Summary - Rule available since: `v1.6.0` - Diagnostic Category: [`lint/suspicious/noFocusedTests`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule has an [**unsafe**](/linter/#unsafe-fixes) fix. - The default severity of this rule is [**warning**](/reference/diagnostics#warning). - This rule belongs to the following domains: - [`test`](/linter/domains#test) - Sources: - Inspired from [`jest/no-focused-tests`](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-focused-tests.md) - Inspired from [`vitest/no-focused-tests`](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md){
"linter": {
"rules": {
"suspicious": {
"noFocusedTests": "error"
}
}
}
}
Disallow focused tests.
Disabled test are useful when developing and debugging, because it forces the test suite to run only certain tests.
However, in pull/merge request, you usually want to run all the test suite.
describe.only("foo", () => {});
test.only("foo", () => {});
test.only.each([["a"]])("%s", (a) => {});
test("foo", () => {});
test.each([["a"]])("%s", (a) => {});