Skip to content
masterclass Buddy

Jest · Module

mockImplementation

jest.fn() creates a mock function. mockImplementation(fn) gives it behavior while Jest continues recording its calls.

Last updated

Syntax

mockFn.mockImplementation(fn)

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

Subscribe
  • jest.fn()
  • mockFn.mockImplementationOnce(fn)
  • mockFn.mock.calls
  • mockFn.mockReset()
  • mockFn.mockRestore()
  • jest.spyOn()

Source: Mock Functions · Jest. Checked 2026-11-03.