# require-test-timeout

Rule `vitest/require-test-timeout`. Require tests to declare a timeout

- 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: #1810 by reach

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
it('slow test', async () => {
  await doSomethingSlow()
})
```

### Correct: the rule accepts this

```js
// good (numeric timeout)
test('slow test', async () => {
  await doSomethingSlow()
}, 1000)

// good (options object)
test('slow test', { timeout: 1000 }, async () => {
  await doSomethingSlow()
})

// good (file-level)
vi.setConfig({ testTimeout: 1000 })

test('slow test', async () => {
  await doSomethingSlow()
})
```

Examples from the Oxlint documentation.

## Enable it

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

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

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

### Oxlint: `.oxlintrc.json`

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

## Related rules

- [vitest/require-mock-type-parameters](https://lintradar.dev/rules/vitest/require-mock-type-parameters.md): Enforce using type parameters with vitest mock functions
- [vitest/require-to-throw-message](https://lintradar.dev/rules/vitest/require-to-throw-message.md): Require toThrow() to be called with an error message
- [vitest/require-hook](https://lintradar.dev/rules/vitest/require-hook.md): Require setup and teardown to be within a hook
- [vitest/warn-todo](https://lintradar.dev/rules/vitest/warn-todo.md): Disallow `.todo` usage
- [vitest/require-awaited-expect-poll](https://lintradar.dev/rules/vitest/require-awaited-expect-poll.md): Ensure that every `expect.poll` call is awaited
- [vitest/prefer-todo](https://lintradar.dev/rules/vitest/prefer-todo.md): Enforce using `test.todo`

---

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