Skip to content

skipped-test ​

A test that doesn't run, and nothing says why: test.skip, it.todo, describe.skip, xit / xtest / xdescribe, test.skipIf(true), node:test's { skip: true } / { todo: true }, t.skip() with no reason, a test with no body (test("name")) and one whose body is empty (test("name", () => {}), often a body taken out or commented out). Reported in test files. A warning by default.

Every skipped test is counted among the escape hatches, with a reason or without: in check's escape-hatch line, in --json --summary and in the baseline (skippedTests), so a ratchet catches a new one.

Why: a skipped test is a test that stopped checking, and the run passes. Skipping the test that fails is the shortest way to get a green run. A skip that says why can be reviewed and undone; one that doesn't stays forever. Guide: Testing.

✕ Rejectedskipped-test
ts
import assert from "node:assert/strict";
import { test } from "node:test";

function total(prices: readonly number[]): number {
  return prices.reduce((sum, price) => sum + price, 0);
}

test("total adds the prices", { skip: true }, () => {
  assert.equal(total([3, 4]), 7);
});

✅ Accepted: the reason is given (node:test prints it), or written on the line above

✓ Accepted0 diagnostics
ts
import assert from "node:assert/strict";
import { test } from "node:test";

function total(prices: readonly number[]): number {
  return prices.reduce((sum, price) => sum + price, 0);
}

test("totals in cents", { skip: "rounding to cents is decided in #41" }, () => {
  assert.equal(total([0.1, 0.2]), 0.3);
});

// Skipped until the catalogue mock serves prices (#57).
test.skip("total of a basket from the catalogue", () => {
  assert.equal(total([3, 4]), 7);
});

A condition is a reason too: test.skipIf(process.platform === "win32"), t.skip("no symlinks on Windows") inside an if, { skip: !process.env.DATABASE_URL }. Those aren't reported, and are counted.

A reason on the line above is a comment of a few words directly above the call; the comment at the end of the same line isn't read.

What the rule can't see ​

  • A test commented out whole (// test("total", ...)): it is a comment, not a test.
  • A skip decided outside the file: a config's exclude, a CLI filter, test.fails.

MIT OR Apache-2.0 · Docs by Gemini 4 Neon Extra