noFocusedTests
¥Summary
-
规则生效日期:
v1.6.0¥Rule available since:
v1.6.0 -
诊断类别:
lint/suspicious/noFocusedTests¥Diagnostic Category:
lint/suspicious/noFocusedTests -
此规则包含 unsafe 修复程序。
¥This rule has an unsafe fix.
-
此规则的默认严重级别为 warning。
¥The default severity of this rule is warning.
-
此规则属于以下域:
¥This rule belongs to the following domains:
-
来源:
¥Sources:
-
¥Inspired from
jest/no-focused-tests -
¥Inspired from
vitest/no-focused-tests
-
¥How to configure
{ "linter": { "rules": { "suspicious": { "noFocusedTests": "error" } } }}¥Description
禁止重点测试。
¥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.
¥Examples
¥Invalid
describe.only("foo", () => {});code-block.js:1:10 lint/suspicious/noFocusedTests FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Don’t focus the test.
> 1 │ describe.only(“foo”, () => {});
│ ^^^^
2 │
ℹ The ‘only’ method is often used for debugging or during implementation.
ℹ Consider removing ‘only’ to ensure all tests are executed.
ℹ Unsafe fix: Remove focus from test.
1 │ describe.only(“foo”,·()·=>·{});
│ -----
test.only("foo", () => {});code-block.js:1:6 lint/suspicious/noFocusedTests FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Don’t focus the test.
> 1 │ test.only(“foo”, () => {});
│ ^^^^
2 │
ℹ The ‘only’ method is often used for debugging or during implementation.
ℹ Consider removing ‘only’ to ensure all tests are executed.
ℹ Unsafe fix: Remove focus from test.
1 │ test.only(“foo”,·()·=>·{});
│ -----
test.only.each([["a"]])("%s", (a) => {});code-block.js:1:6 lint/suspicious/noFocusedTests FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Don’t focus the test.
> 1 │ test.only.each([[“a”]])(“%s”, (a) => {});
│ ^^^^
2 │
ℹ The ‘only’ method is often used for debugging or during implementation.
ℹ Consider removing ‘only’ to ensure all tests are executed.
ℹ Unsafe fix: Remove focus from test.
1 │ test.only.each([[“a”]])(“%s”,·(a)·=>·{});
│ -----
¥Valid
test("foo", () => {});test.each([["a"]])("%s", (a) => {});¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号