Vitest Fetch Mock

JSON →
library 0.4.5 ·javascript
verified Jun 7, 2026

Vitest Fetch Mock (v0.4.5) is a fetch mocking library for Vitest, forked from jest-fetch-mock. It mocks the global fetch API using Vitest's vi.fn() under the hood, providing a simple API to mock responses, inspect calls, and reset state. Works with Vitest >=2.0.0 and Node >=18. Unlike nock or msw, it directly replaces global.fetch without interceptors or service workers. Ships TypeScript types.