{"library":"jest-mock-fetch","type":"library","category":null,"description":"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.","language":"javascript","status":"active","version":"2.0.5","tags":["javascript","fetch","jest","mock","typescript"],"last_verified":"Sun Jun 07","install":[{"cmd":"npm install jest-mock-fetch","imports":["import fetch from 'jest-mock-fetch';","fetch.mockResponse({ text: () => 'OK' });","fetch.reset();"]},{"cmd":"yarn add jest-mock-fetch","imports":[]},{"cmd":"pnpm add jest-mock-fetch","imports":[]}],"homepage":"https://github.com/knee-cola/jest-mock-fetch#readme","github":"https://github.com/knee-cola/jest-mock-fetch","docs":null,"changelog":null,"pypi":null,"npm":"jest-mock-fetch","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":null}