Linter · Rules
jest/no-disabled-tests
Disallow skipped tests such as test.skip, xtest and xdescribe
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, the x prefix (xtest, xit, xdescribe), a test with a title but no function, and calls to Jasmine's pending(). test.todo is allowed.
Configure
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"jest/no-disabled-tests" = "error" # or "warn"
Examples
Reported:
import { describe, expect, test, xtest } from "@jest/globals";
describe.skip("checkout", () => {
test("adds the tax", () => {
expect(total(100)).toBe(108);
});
});
xtest("applies the coupon", () => {
expect(total(100, "SAVE10")).toBe(97.2);
});
A test with no function has nothing to run:
import { test } from "@jest/globals";
test("refunds the order");
Not reported:
import { expect, test } from "@jest/globals";
test("adds the tax", () => {
expect(total(100)).toBe(108);
});
test.todo("refunds the order");