Skip to content

empty-test-suite ​

A describe with no test in it, and a test file (named *.test.ts / *.spec.ts) that imports a runner's test or describe and registers no test. Reported in test files. A warning by default.

Why: an empty suite checks nothing. node:test passes it; Vitest and Jest fail the file ("No test found"), so under node:test the run is green with the tests gone. It is often what is left after the tests were moved or deleted to get a green run. Guide: Testing.

✕ Rejectedempty-test-suite
ts
import { describe } from "node:test";

describe("total", () => {});
✓ Accepted0 diagnostics
ts
import assert from "node:assert/strict";
import { describe, test } from "node:test";

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

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

A file that registers no test and imports no runner's test is left alone: it may be a compile-time test, checked by its @ts-expect-error lines.

What the rule can't see ​

A suite's (or a test's) body passed by a name nothing else reads (describe("cart", cartTests) with const cartTests = () => { ... }) is read as if written there; one whose name is read elsewhere too counts as registering tests. A suite whose tests come from a helper (describe("cart", () => sharedCartTests())): any call in the suite's body that may register tests counts as registering them.

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