Skip to content
masterclass Buddy

Jest · Function

afterEach

afterEach runs cleanup after every test in its scope. It can wait for asynchronous cleanup and accepts an optional timeout in milliseconds.

Last updated

Syntax

afterEach(fn, timeout)

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

Subscribe
  • afterAll
  • beforeEach
  • beforeAll
  • describe

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