# consistent-test-it

Rule `vitest/consistent-test-it`. Enforce using test or it but not both

- Source: vitest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 758.7K weekly downloads of presets that enable it
- Trend: +49.9% last quarter
- Rank: #1570 by reach, #787 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vitest/consistent-test-it` | no | safe | package `@vitest/eslint-plugin` | [docs](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md) |
| Oxlint | `vitest/consistent-test-it` | no | safe | plugin `vitest`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/vitest/consistent-test-it.html) |
| Biome | `style/useConsistentTestIt` | no | safe | group style, since 2.4.11 | [docs](https://biomejs.dev/linter/rules/use-consistent-test-it/) |

## Code examples

### Incorrect: the rule reports this

```js
test('using test function', () => {
  // ...
})

// Invalid: the top level keyword defaults to `test`
it('using it function', () => {
  // ...
})
```

### Correct: the rule accepts this

```js
test('using test function', () => {
  // ...
})

test('using only test function', () => {
  // ...
})
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { vitest },
    rules: {
      "vitest/consistent-test-it": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "vitest"
  ],
  "rules": {
    "vitest/consistent-test-it": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "useConsistentTestIt": "error"
      }
    }
  }
}
```

## Presets that enable it

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

## Related rules

- [jest/consistent-test-it](https://lintradar.dev/rules/jest/consistent-test-it.md): Enforce `test` and `it` usage conventions
- [vitest/prefer-hooks-in-order](https://lintradar.dev/rules/vitest/prefer-hooks-in-order.md): Enforce having hooks in consistent order
- [vitest/prefer-lowercase-title](https://lintradar.dev/rules/vitest/prefer-lowercase-title.md): Enforce lowercase titles
- [vitest/max-nested-describe](https://lintradar.dev/rules/vitest/max-nested-describe.md): Require describe block to be less than set max value or default value
- [vitest/no-duplicate-hooks](https://lintradar.dev/rules/vitest/no-duplicate-hooks.md): Disallow duplicate hooks and teardown hooks
- [vitest/no-hooks](https://lintradar.dev/rules/vitest/no-hooks.md): Disallow setup and teardown hooks

---

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