diff --git a/docs/docs/Usage/requirements.md b/docs/docs/Usage/requirements.md index f826c814..59d5b963 100644 --- a/docs/docs/Usage/requirements.md +++ b/docs/docs/Usage/requirements.md @@ -14,3 +14,10 @@ fetch-mock requires the following to run: For usage in older versions of Node.js or older browsers consider [using an older version of fetch-mock](/fetch-mock/docs/legacy-api). If using node-fetch in your application fetch-mock@12 and above may work for you, but the fetch-mock test suite does not run against node-fetch, so it may be safer to use an [older version of fetch-mock](http://localhost:3000/fetch-mock/docs/legacy-api/) that is tested against node-fetch and is less likely to introduce breaking changes. + +## Usage with react-native + +As react-native ships with a non-spec-compliant version of the URL and URLSearchParams classes, fetch-mock will not run in a react-native environment unless you also include [react-native-url-polyfill](https://www.npmjs.com/package/react-native-url-polyfill). You can either: + +1. Include it in your application code. This will add approx 11kb of gzipped code to your bundle. +2. Include it in your test files only. If doing this, its recommended that you have some integration tests that _don't_ use fetch-mock in order to avoid inserting behaviour into your application that relies on the polyfill. diff --git a/docs/docs/Usage/upgrade-guide.md b/docs/docs/Usage/upgrade-guide.md index b2e6e284..e1507cff 100644 --- a/docs/docs/Usage/upgrade-guide.md +++ b/docs/docs/Usage/upgrade-guide.md @@ -22,11 +22,13 @@ The filtering behaviour has been rewritten around named routes, and methods retu ## Some convenience routing methods removed -`getOnce()` and `getAnyOnce()`. have all been removed, but the behaviour can still be implemented by the user as follows: +`getOnce()` and `getAnyOnce()` have been removed, but the behaviour can still be implemented by the user as follows: - `getOnce()` -> `get(url, response, {repeat: 1})` - `getAnyOnce()` -> `get('*', response, {repeat: 1})` +The same is true for `postOnce()`, `deleteOnce()` etc. + ## Options removed - `overwriteRoutes` - this reflects that multiple routes using the same underlying matcher but different options no longer throw an error.