Linter · Rules
vitest/no-disabled-tests
Disallow skipped tests such as test.skip and describe.skip
A skipped test doesn't run, and the run still passes. .skip is useful while you work on something else. If it stays in the code, nobody notices when the behavior it covered breaks.
The rule reports .skip on test, it and describe, and a test with a title but no function. test.todo and test.skipIf(condition) are allowed.
Configure
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"vitest/no-disabled-tests" = "error" # or "warn"
Examples
Reported:
import { describe, expect, test } from "vitest";
describe.skip("checkout", () => {
test("adds the tax", () => {
expect(total(100)).toBe(108);
});
});
test.skip("applies the coupon", () => {
expect(total(100, "SAVE10")).toBe(97.2);
});
A test with no function has nothing to run:
import { test } from "vitest";
test("refunds the order");
Not reported:
import { expect, test } from "vitest";
test("adds the tax", () => {
expect(total(100)).toBe(108);
});
test.todo("refunds the order");
test.skipIf(process.platform === "win32")("follows the symlink", () => {
expect(resolve("current")).toBe("releases/42");
});