software engineering3 min read

Mock Service Worker v3.0 Released with ESM-Only Build and Socket-Based Interception

2 similar posts
  • Mock Service Worker
  • Node.js
  • TypeScript
  • GraphQL
  • Nock
  • Cloudflare Workers
  • Jest
  • JSDOM

AI Summary

Mock Service Worker (MSW) version 3.0 has been released, shifting to an ESM-only distribution, dropping support for older Node.js versions, and reducing package size. Key updates include GraphQL subscription support, granular entrypoints, and an experimental defineNetwork API. The underlying Node.js interception architecture now operates at the TCP and TLS layer for deeper runtime control. While these changes provide modern performance and broader protocol coverage, teams upgrading from version 2 should review breaking changes, including newly intercepted preflight requests.

Key Takeaways

  • MSW v3.0 is distributed natively as ESM-only.
  • Introduces socket-level network interception in Node.js at the TCP and TLS bindings.
  • Adds GraphQL subscription support and an experimental defineNetwork API.

Why it matters

MSW v3.0 introduces fundamental architectural changes to network mocking in Node.js and the browser, impacting testing strategies, dependency footprints, and protocol support for full-stack JavaScript applications.

Conversation0

What would you add from your experience?

Checking your session…

Every good conversation starts with one perspective.