vitest/no-test-prefixes

Require .only and .skip instead of the f and x prefixes

fixable

fit, fdescribe, xit, xtest and xdescribe are Jest's short names for it.only, describe.only, it.skip, test.skip and describe.skip. Vitest doesn't export them, so a test file that you moved over from Jest needs to use the long names.

--fix rewrites the short name to the long one. It doesn't change your imports.

Configure#

Off by default. To turn it on:

bunfig.toml
[lint.rules]
"vitest/no-test-prefixes" = "error" # or "warn"

Examples#

example.ts3 problems
import { expect } from "vitest";

fit("adds", () => {
  expect(1 + 1).toBe(2);
});

xtest("subtracts", () => {
  expect(3 - 1).toBe(2);
});

xdescribe("division", () => {});
example.tsNo problems
import { describe, expect, it, test } from "vitest";

it.only("adds", () => {
  expect(1 + 1).toBe(2);
});

test.skip("subtracts", () => {
  expect(3 - 1).toBe(2);
});

describe.skip("division", () => {});

xit.each is reported too, and --fix turns it into it.skip.each:

example.ts1 problem
import { expect } from "vitest";

xit.each([1, 2, 3])("%i is positive", n => {
  expect(n).toBeGreaterThan(0);
});