vitest/no-import-node-test

January 2, 2026 ยท View on GitHub

๐Ÿ“ Disallow importing node:test.

๐Ÿ’ผโš ๏ธ This rule is enabled in the โœ… recommended config. This rule warns in the ๐ŸŒ all config.

๐Ÿ”ง This rule is automatically fixable by the --fix CLI option.

Rule Details

This rule warns when node:test is imported (usually accidentally). With --fix, it will replace the import with vitest.

Examples of incorrect code for this rule:

import { test } from 'node:test'
import { expect } from 'vitest'

test('foo', () => {
  expect(1).toBe(1)
})

Examples of correct code for this rule:

import { test, expect } from 'vitest'

test('foo', () => {
  expect(1).toBe(1)
})