jest-mock-fetch
JSON →An ultra-lightweight synchronous fetch mock for Jest, designed to mock the native fetch API or polyfill libraries like unfetch. Version 2.0.5 is stable and actively maintained. Key differentiators: synchronous promise resolution for deterministic tests, simple API (mockResponse, mockError, lastReqGet, lastPromiseGet), and TypeScript support. It provides a mock fetch function that can be used as a Jest spy, enabling assertions on calls and simulation of server responses. Breaking changes in v2.0.0 aligned the API with the official fetch spec.
Resources
packagejest-mock-fetch ↗