jest/no-disabled-tests 正确性
它的作用
此规则会对被禁用的测试发出警告。
这为什么不好?
Jest 提供了一个功能,允许你临时将测试标记为禁用。这个 功能在调试时或为未来的测试创建占位符时通常很有帮助。在提交更改之前,我们可能希望检查所有测试是否都 在运行。
示例
js
describe.skip("foo", () => {});
it.skip("foo", () => {});
test.skip("foo", () => {});
describe["skip"]("bar", () => {});
it["skip"]("bar", () => {});
test["skip"]("bar", () => {});
xdescribe("foo", () => {});
xit("foo", () => {});
xtest("foo", () => {});
it("bar");
test("bar");
it("foo", () => {
pending();
});如何使用
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["jest"],
"rules": {
"jest/no-disabled-tests": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["jest"],
rules: {
"jest/no-disabled-tests": "error",
},
});bash
oxlint --deny jest/no-disabled-tests --jest-plugin版本
此规则在 v0.0.7 中添加。
