Skip to content
masterclass Buddy

Vitest · Function

afterAll

afterAll runs one callback after all tests in the current suite finish. It is useful for one-time cleanup, such as stopping a server or closing a database connection.

Last updated

Syntax

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

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

Subscribe
  • beforeAll
  • beforeEach
  • afterEach
  • aroundAll
  • hookTimeout
  • ModuleContext

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