Skip to content

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

Merged
renovate[bot] merged 1 commit into
mainfrom
renovate/jest-fetch-mock-4.x
Jul 9, 2026
Merged

chore(deps): update dependency jest-fetch-mock to v4#114
renovate[bot] merged 1 commit into
mainfrom
renovate/jest-fetch-mock-4.x

Conversation

@renovate

@renovate renovate Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
jest-fetch-mock 3.2.04.1.0 age confidence

Release Notes

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

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 force-pushed the renovate/jest-fetch-mock-4.x branch from 0f18fda to a0d960d Compare July 8, 2026 17:02
@renovate renovate Bot merged commit fbcc2ff into main Jul 9, 2026
5 checks passed
@renovate renovate Bot deleted the renovate/jest-fetch-mock-4.x branch July 9, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants