vitest/require-test-timeout
@vitest/eslint-plugin
No autofix
eslint.config.js
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/require-test-timeout": "error",
},
},
];it('slow test', async () => {
await doSomethingSlow()
})// 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.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vitest/require-test-timeout
@vitest/eslint-plugin
import vitest from "@vitest/eslint-plugin";
export default [
{
plugins: { vitest },
rules: {
"vitest/require-test-timeout": "error",
},
},
];vitest/require-test-timeout
vitest plugin · restriction
{
"plugins": [
"vitest"
],
"rules": {
"vitest/require-test-timeout": "error"
}
}Biome does not have this rule.
Enforce using type parameters with vitest mock functions
Require toThrow() to be called with an error message
Ensure that every expect.poll call is awaited