chore(deps): update dependency jest-fetch-mock to v4#114
Merged
Conversation
0f18fda to
a0d960d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
3.2.0→4.1.0Release Notes
jefflau/jest-fetch-mock (jest-fetch-mock)
v4.1.0Compare Source
Added
fetchMock.Response.redirect(),.error()and (on native fetch).json()statics are exposed through the Response wrapper (#191)Docs
setupFilesAfterEnvone-liner as the primary setup, rewrittenresetMocksnote around the auto-re-arm, self-contained types, redirected mocking works everywhere,realFetchin examples)v4.0.0Compare Source
The modernization release (published as
4.0.0-beta.1earlier the same day; identical content). Headline: jest-fetch-mock no longer replaces the global fetch classes with node-fetch implementations.Changed (breaking)
fetch/Response/Request/Headers(jest-environment-node has since Jest 28), the mock builds on them and never replaces them — fixing the whole "the globalResponsebroke my unrelated test" cluster (#218) and makinginstanceof, streams,FormData, andResponse.json()behave natively. Where the environment has none (jest-environment-jsdom), the cross-fetch fallback engages exactly as before, filling only the missing globals.disableMocks()restores the environment's originalfetch(previously it installed cross-fetch's).@types/jestrequirement (works with@jest/globals-only setups, #248) and no forceddomlib (#201). AmbientResponse/Requesttypes must come from yourlib: ["dom"]or@types/node≥ 18 — in practice, every Jest project has one of these.http://localhost/for matching purposes (the nativeRequestrequires absolute URLs); jsdom-fallback behavior is unchanged.domexceptiondependency removed (native since Node 17).Added
createFetchMock(jest)factory, also available from the dependency-free entryjest-fetch-mock/factory— build an instance with an explicitly-passed jest object, forinjectGlobals: false/@jest/globalssetups."setupFiles": ["jest-fetch-mock/setup"]one-liner setup.resetMocks: trueauto-re-arm (#78, #81, #202): whenenableMocks()runs wherebeforeEachexists (setupFilesAfterEnvor a test file), the default implementation is re-armed after Jest's config-driven reset. The years-old footgun is fixed — move your setup file tosetupFilesAfterEnvto benefit.AbortSignal.timeout()rejections carry the signal'sTimeoutError; custom abort reasons pass through as-is (#242). Plain aborts keep the historicalAbortErrormessage.fetchMock.defaultResponseInit— an init merged under every mocked response, e.g. default JSON headers (#166).fetchMock.realFetch— the implementation unmatched requests pass through to, reassignable in tests;fetchMock.usingNativeFetchtells you which mode engaged.exportsmap (with a./*escape hatch so deep imports keep working);urlandcounterMockParams are patched onto native responses soresponse.url/response.redirectedmocking still works.Unchanged
Every 3.x API call, alias, chaining behavior, once-queue semantics, and the abort error message. The whole 3.x test suite and all seven consumer integration fixtures run green against 4.0.
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.