Skip to content
masterclass Buddy

Vitest · Function

beforeAll

beforeAll runs setup once before all tests in the current suite. It supports async work, a timeout, and an optional cleanup function.

Last updated

Syntax

function beforeAll(body: (context: ModuleContext) => unknown, timeout?: number): void

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

Subscribe
  • afterAll
  • beforeEach
  • afterEach
  • aroundAll
  • hookTimeout
  • ModuleContext

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