Skip to content

nodeTestImports

Reports importing from node:test.

✅ This rule is included in the vitest logical and logicalStrict presets.

Vitest and Node.js’s built-in test runner provide similar APIs, but they are different test runners with different execution models and features. Importing from node:test inside Vitest-targeted files usually means the wrong runner API was imported.

import { describe, it } from "node:test";
describe("math", () => {
it("adds values", () => {});
});
import * as test from "node:test";
test.describe("math", () => {
test.it("subtracts values", () => {});
});

This rule is not configurable.

If a file is intentionally written for Node.js’s built-in test runner, you should not apply the Vitest plugin to that file. In mixed repositories, prefer separate Flint file globs or config entries so node:test files and Vitest files are linted with the right plugin.

Made with ❤️‍🔥 around the world by the Flint team and contributors.