Skip to content

chore(deps): update dependency jest-fetch-mock to v4 - #1314

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/jest-fetch-mock-4.x
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/jest-fetch-mock-4.x

Conversation

@renovate

@renovate renovate Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
jest-fetch-mock 3.2.0 → 4.2.0 age confidence

Release Notes

jefflau/jest-fetch-mock (jest-fetch-mock)

v4.2.0

Compare Source

Added
  • Route-based mocking (#​171): fetchMock.route(urlOrPredicate, bodyOrFunction?, init?) and routeOnce(...) register matcher→response pairs that coexist, plus clearRoutes(). First registered match serves. Precedence: queued once-responses > routes > the conditional gate and ambient mockResponse; a matching route fires even under dontMock() (mock only known endpoints, let the rest hit the network); mockReject/mockAbort override routes. resetMocks() clears routes.

v4.1.0

Compare Source

Added
  • fetchMock.Response.redirect(), .error() and (on native fetch) .json() statics are exposed through the Response wrapper (#​191)
Docs
  • README fully aligned with 4.0 (native-primitives intro, setupFilesAfterEnv one-liner as the primary setup, rewritten resetMocks note around the auto-re-arm, self-contained types, redirected mocking works everywhere, realFetch in examples)

v4.0.0

Compare Source

The modernization release (published as 4.0.0-beta.1 earlier the same day; identical content). Headline: jest-fetch-mock no longer replaces the global fetch classes with node-fetch implementations.

Changed (breaking)
  • Native fetch primitives. In environments that provide fetch/Response/Request/Headers (jest-environment-node has since Jest 28), the mock builds on them and never replaces them — fixing the whole "the global Response broke my unrelated test" cluster (#​218) and making instanceof, streams, FormData, and Response.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 original fetch (previously it installed cross-fetch's).
  • Support floor: Node ≥ 18, Jest ≥ 28. The 3.x line remains available for older stacks.
  • TypeScript definitions are self-contained: no @types/jest requirement (works with @jest/globals-only setups, #​248) and no forced dom lib (#​201). Ambient Response/Request types must come from your lib: ["dom"] or @types/node ≥ 18 — in practice, every Jest project has one of these.
  • Relative URL inputs in native mode resolve against http://localhost/ for matching purposes (the native Request requires absolute URLs); jsdom-fallback behavior is unchanged.
  • domexception dependency removed (native since Node 17).
Added
  • createFetchMock(jest) factory, also available from the dependency-free entry jest-fetch-mock/factory — build an instance with an explicitly-passed jest object, for injectGlobals: false / @jest/globals setups.
  • "setupFiles": ["jest-fetch-mock/setup"] one-liner setup.
  • resetMocks: true auto-re-arm (#​78, #​81, #​202): when enableMocks() runs where beforeEach exists (setupFilesAfterEnv or 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 to setupFilesAfterEnv to benefit.
  • AbortSignal.timeout() rejections carry the signal's TimeoutError; custom abort reasons pass through as-is (#​242). Plain aborts keep the historical AbortError message.
  • 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.usingNativeFetch tells you which mode engaged.
  • ESM wrapper and an exports map (with a ./* escape hatch so deep imports keep working); url and counter MockParams are patched onto native responses so response.url/response.redirected mocking 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)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 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.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the renovate label Aug 7, 2026
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 10 times, most recently from 03906be to 7b0a09d Compare August 10, 2026 01:03
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 3 times, most recently from d19560a to d995d0b Compare August 16, 2026 12:49
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 9 times, most recently from 435c876 to adea776 Compare September 4, 2026 22:19
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 5 times, most recently from d662bd8 to da0eb0b Compare September 23, 2026 02:47
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 2 times, most recently from 33be271 to 3fb8536 Compare October 1, 2026 15:51
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 2 times, most recently from 2c90d88 to a34c74e Compare October 8, 2026 10:58
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 2 times, most recently from 2d5dd58 to 0af8a3b Compare October 19, 2026 06:04
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 6 times, most recently from 7b146fb to 84e970a Compare October 28, 2026 01:35
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch 4 times, most recently from 655cba3 to 9979e0d Compare November 7, 2026 21:41
@renovate
renovate Bot force-pushed the renovate/jest-fetch-mock-4.x branch from 9979e0d to 7766a32 Compare November 13, 2026 17:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants