Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Linter · Rules

vitest/prefer-todo

Require test.todo for tests that have no body yet

A test with an empty body passes, so the summary counts a test you haven't written yet as one that works. Vitest counts a test.todo as todo, not as passed.

A test with only a title is reported too, and so is an empty test.skip.

--fix rewrites the call to test.todo and removes the empty function.

Configure

Off by default. To turn it on:

bunfig.toml
[lint.rules]
"vitest/prefer-todo" = "error" # or "warn"

Examples

Reported:

import { test } from "vitest";

test("rejects an expired token", () => {});

test("refreshes the token");

test.skip("logs out", function () {});

Not reported:

import { expect, test } from "vitest";

test.todo("rejects an expired token");

test("accepts a valid token", () => {
  expect(verify(token)).toBe(true);
});