# no-import-node-test

Rule `vitest/no-import-node-test`. Disallow importing `node:test`

- Source: vitest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 6.6M weekly downloads of presets that enable it
- Trend: +60.0% last quarter
- Rank: #1157 by reach, #716 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vitest/no-import-node-test` | yes | safe | package `@vitest/eslint-plugin` | [docs](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md) |
| Oxlint | `vitest/no-import-node-test` | no | safe | plugin `vitest`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-import-node-test.html) |

## Code examples

### Incorrect: the rule reports this

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

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

### Correct: the rule accepts this

```ts
import { test, expect } from 'vitest'

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

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import vitest from "@vitest/eslint-plugin";

export default [
  {
    plugins: { vitest },
    rules: {
      "vitest/no-import-node-test": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "vitest"
  ],
  "rules": {
    "vitest/no-import-node-test": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Vitest recommended](https://lintradar.dev/presets/vitest-recommended.md) | ESLint | `@vitest/eslint-plugin` | 17 | 5.9M | +61.5% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |

## Related rules

- [vitest/no-identical-title](https://lintradar.dev/rules/vitest/no-identical-title.md): Disallow identical titles
- [vitest/expect-expect](https://lintradar.dev/rules/vitest/expect-expect.md): Enforce having expectation in test body
- [vitest/no-conditional-expect](https://lintradar.dev/rules/vitest/no-conditional-expect.md): Disallow conditional expects
- [vitest/no-disabled-tests](https://lintradar.dev/rules/vitest/no-disabled-tests.md): Disallow disabled tests
- [vitest/no-focused-tests](https://lintradar.dev/rules/vitest/no-focused-tests.md): Disallow focused tests
- [vitest/no-standalone-expect](https://lintradar.dev/rules/vitest/no-standalone-expect.md): Disallow using `expect` outside of `it` or `test` blocks

---

Web page: https://lintradar.dev/rules/vitest/no-import-node-test. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
