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.
SubscribeRelated
jest.fn()mockFn.mockImplementationOnce(fn)mockFn.mock.callsmockFn.mockReset()mockFn.mockRestore()jest.spyOn()