Skip to content

Glossary: Testing Web Apps

vi.mock

Also written: vi.mocked, mockResolvedValue

A Vitest call that replaces every export of a module, such as api.js, with mock functions. `vi.mocked(fn)` gives you the mock so you can set its answer.

Where the book teaches it

Related terms

HoistingMockMSW