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();
});
此規則與 eslint-plugin-vitest 相容,若要使用,請將以下設定新增至您的 .eslintrc.json
json
{
"rules": {
"vitest/no-disabled-tests": "error"
}
}