From 7ce13a441894e62b28e46d113e90f5b8d5220931 Mon Sep 17 00:00:00 2001 From: Ryan Rhee Date: Wed, 26 Jan 2022 15:05:57 -0500 Subject: [PATCH] Document ponyfill mock resolves #122 From https://github.com/jefflau/jest-fetch-mock/issues/122#issuecomment-913774897 --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 956924f..84906d4 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,16 @@ If you are using [Create-React-App](https://github.com/facebookincubator/create- } ``` +### Usage with cross-mock ponyfills + +If you are using the [`cross-fetch`](https://github.com/lquixada/cross-fetch) [ponyfill](https://github.com/sindresorhus/ponyfill), set the jest mock directly rather than `enableFetchMock()`. Add the following lines to the start of your test case (before any other imports): + +``typescript +// +import fetchMock from "jest-fetch-mock"; +jest.setMock("cross-fetch", fetchMock); +``` + ## API ### Mock Responses