diff --git a/docs/docs/API/more-routing-methods.md b/docs/docs/API/more-routing-methods.md index 5ebca9ca..aea510a5 100644 --- a/docs/docs/API/more-routing-methods.md +++ b/docs/docs/API/more-routing-methods.md @@ -7,6 +7,8 @@ sidebar_label: More routing methods These methods allow defining routes for common use cases while avoiding writing hard to read configuration objects. They all return the fetchMock instance, and are therefor chainable. Unless noted otherwise, each of the methods below have the same signature as `.route()`. +> Note that in older versions of fetch-mock these methods woudl also replace global `fetch` with your mock. From version 12 onwards this is no longer the case, and you will need to start your tests with `fetchMock.mockGlobal()` or similar. [Read the mocking and spying docs](/fetch-mock/docs/API/mocking-and-spying). + ## .catch() `.catch(response)` diff --git a/docs/docs/Usage/upgrade-guide.md b/docs/docs/Usage/upgrade-guide.md index e1096e6b..e2528ba7 100644 --- a/docs/docs/Usage/upgrade-guide.md +++ b/docs/docs/Usage/upgrade-guide.md @@ -16,6 +16,10 @@ Previously this was true in browsers, but in node.js the node-fetch library was This combined adding a route with mocking the global instance of `fetch`. These are now split into 2 methods: `.route()` and `.mockGlobal()`. +### Routing convenience methods no longer mock `fetch` + +Similar to the last point, `.once()`, `.get()`, `.post()`, `getOnce()`, `postOnce()` and all other routing convenience methods no longer mock the global instance of `fetch`, and you will need to call `.mockGlobal()` explicitly. + ### Reset methods changed `.reset()`, `.restore()`, `.resetBehavior()` and `.resetHistory()` have been removed and replaced with [methods that are more granular and clearly named](/fetch-mock/docs/API/resetting). Note that the [jest](/fetch-mock/docs/wrappers/jest) and [vitest](/fetch-mock/docs/wrappers/vitest) wrappers for fetch-mock still implement `.mockClear()`, `mockReset()` and `mockRestore()`.