Skip to content
masterclass Buddy

Vitest · Function

test

test defines a test case with a name and a function containing expectations. Vitest can wait for asynchronous tests and supports options such as skipping, retries, concurrency, and custom timeouts.

Last updated

Syntax

function test(name: string | Function, body?: () => unknown, timeout?: number): void
function test(name: string | Function, options: TestOptions, body?: () => unknown): void

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • it
  • test.skip
  • test.only
  • test.concurrent
  • test.todo
  • test.fails
  • test.each
  • test.for

Source: Test | Vitest. Checked 2026-11-03.