bun:test/no-disabled-tests

Disallow skipped tests such as test.skip, xtest and xdescribe

warn by default

A skipped test doesn't run, and bun test still passes. .skip is useful while you work on something else, but 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), and a test with a title but no function. test.todo and test.skipIf(condition) are allowed.

This rule is on by default, as a warning, in files that import from "bun:test".

Configure#

On by default as a warning. To turn it off:

bunfig.toml
[lint.rules]
"bun:test/no-disabled-tests" = "off" # or "error"

Examples#

example.ts2 problems
import { describe, expect, test, xtest } from "bun:test";

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:

example.ts1 problem
import { test } from "bun:test";

test("refunds the order");
example.tsNo problems
import { expect, test } from "bun:test";

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");
});