Vitest · Function
vi.fn
vi.fn creates a mock function. It can record calls and use a real or custom implementation.
Last updated
Syntax
function fn(fn?: Procedure | Constructable): MockIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
vi.spyOnmockClearmockImplementationmockImplementationOncemockResetmockRestoremockReturnValuemockReturnValueOnce