Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 663 Bytes

File metadata and controls

33 lines (24 loc) · 663 Bytes

vitest/require-test-timeout

📝 Require tests to declare a timeout.

🚫 This rule is disabled in the 🌐 all config.

This rule ensures tests explicitly declare a timeout so long-running tests don't hang silently.

// bad
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()
})