Skip to content
masterclass Buddy

Jest · Function

beforeAll

beforeAll runs setup once before the tests in a file. afterAll runs cleanup once after those tests finish. Jest waits for a returned promise before continuing.

Last updated

Syntax

beforeAll(fn, timeout)
afterAll(fn, timeout)

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

Subscribe
  • afterEach
  • beforeEach
  • describe
  • test

Source: Globals · Jest. Checked 2026-11-03.