Skip to content

Comments

chore: upgrade nock from v13 to v14#7949

Draft
cryptodev-2s wants to merge 1 commit intomainfrom
chore/upgrade-nock-v14
Draft

chore: upgrade nock from v13 to v14#7949
cryptodev-2s wants to merge 1 commit intomainfrom
chore/upgrade-nock-v14

Conversation

@cryptodev-2s
Copy link
Contributor

Explanation

nock v14 uses @mswjs/interceptors for native fetch support, replacing the old isomorphic-fetch hack. This required several compatibility fixes:

  • Add shared jest-environment-jsdom.js exposing Node.js globals (fetch, Response, streams, crypto) needed by @mswjs/interceptors in jsdom
  • Override Response.prototype.json to fix cross-realm prototype issues
  • Patch xhr2 Connection header to fix MSW MockHttpSocket body streaming
  • Update error message assertions for native fetch format changes
  • Remove isomorphic-fetch devDependency (no longer needed)
  • Remove per-package jest.environment.js files (consolidated into shared)

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

nock v14 uses @mswjs/interceptors for native fetch support, replacing
the old isomorphic-fetch hack. This required several compatibility fixes:

- Add shared jest-environment-jsdom.js exposing Node.js globals (fetch,
  Response, streams, crypto) needed by @mswjs/interceptors in jsdom
- Override Response.prototype.json to fix cross-realm prototype issues
- Patch xhr2 Connection header to fix MSW MockHttpSocket body streaming
- Update error message assertions for native fetch format changes
- Remove isomorphic-fetch devDependency (no longer needed)
- Remove per-package jest.environment.js files (consolidated into shared)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant