Skip to content
masterclass Buddy

Jest · Method

jest.restoreAllMocks

Restores spies and replaced properties to their original state. Use it after each test to prevent test changes from leaking into other tests.

Last updated

Syntax

jest.restoreAllMocks()

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

Subscribe
  • jest.spyOn
  • jest.replaceProperty
  • jest.clearAllMocks
  • jest.resetAllMocks
  • mockRestore
  • restore
  • afterEach

Source: The Jest Object. Checked 2026-11-03.