nodeTestImports
Reports importing from
node:test.
✅ This rule is included in the vitestlogicalandlogicalStrictpresets.
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.
Examples
Section titled “Examples”import { describe, it } from "node:test";
describe("math", () => { it("adds values", () => {});});import * as test from "node:test";
test.describe("math", () => { test.it("subtracts values", () => {});});import { describe, it } from "vitest";
describe("math", () => { it("adds values", () => {});});import * as vitest from "vitest";
vitest.describe("math", () => { vitest.it("subtracts values", () => {});});Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”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.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
vitest/no-import-node-test
Made with ❤️🔥 around the world by
the Flint team and contributors.