# consistent-test-filename

Rule `vitest/consistent-test-filename`. Require test file pattern

- Source: vitest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1771 by reach

## Linters

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

## Enable it

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

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

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

### Oxlint: `.oxlintrc.json`

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

## Related rules

- [vitest/consistent-each-for](https://lintradar.dev/rules/vitest/consistent-each-for.md): Enforce using `.each` or `.for` consistently
- [vitest/consistent-vitest-vi](https://lintradar.dev/rules/vitest/consistent-vitest-vi.md): Enforce using vitest or vi but not both
- [vitest/hoisted-apis-on-top](https://lintradar.dev/rules/vitest/hoisted-apis-on-top.md): Enforce hoisted APIs to be on top of the file
- [vitest/max-expects](https://lintradar.dev/rules/vitest/max-expects.md): Enforce a maximum number of expect per test
- [vitest/no-alias-methods](https://lintradar.dev/rules/vitest/no-alias-methods.md): Disallow alias methods
- [vitest/no-conditional-in-test](https://lintradar.dev/rules/vitest/no-conditional-in-test.md): Disallow conditional tests

---

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