Jest · Type Alias
jest.SpyInstance
Jest mock functions record how code calls a function. Create one with jest.fn(), then inspect or control its behavior in a test.
Last updated
Syntax
jest.fn(implementation?)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
jest.fn()jest.isMockFunction(fn)mockFn.mock.callsmockFn.mock.resultsmockFn.mock.instancesmockFn.mockClear()mockFn.mockReset()mockFn.mockRestore()