Mock Service Worker (MSW) version 3.0 is now distributed exclusively as ECMAScript Modules (ESM). This change means Node.js v18 and v20 are no longer supported; users must upgrade to Node.js v22, v24, or v26. The minimum TypeScript version required is now 5.9.
Several transitive dependencies, including graphql, path-to-regexp, picocolors, and statuses, have been removed or made optional. This reduction in dependencies has decreased the library's tarball size from 416KB to 234KB, with type definitions shrinking from 190KB to 90KB. The update also introduces granular entrypoints, replacing a single 'msw' import with protocol-specific paths like 'msw/http' or 'msw/graphql'.
A significant addition in v3.0 is support for GraphQL subscriptions, a feature frequently requested by the community. Building on existing WebSocket interception capabilities, developers can now define subscription handlers using 'graphql.link()' to publish events on demand. This closes the gap in MSW's coverage across HTTP, WebSocket, and GraphQL protocols.
MSW v3.0 introduces an experimental 'defineNetwork' API, intended to replace 'setupServer' and 'setupWorker'. This new primitive separates interception into 'sources' (where traffic originates) and 'handlers' (how requests are answered). This design allows for replaying HAR files, combining custom interceptors, and delegating request timing control to test runners. The '@msw/cloudflare' package is the first to directly expose this API for Workers environments.
The most technically significant change is within the underlying Interceptors library. The team has moved network interception in Node.js to the TCP and TLS wraps, which are JavaScript bindings for Node's C-level network code. This new architecture supports arbitrary socket-based protocols, with SMTP cited as an early example. This deep level of interception is described as going as far into the runtime as JavaScript allows without recompiling Node.js itself.
✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →
One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.
One email a day. Unsubscribe in one click, any time.
Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.
▶ Play today's briefNew every morning, and the back catalogue is archived by date.
Mock Service Worker (MSW) released version 3.0, transitioning to an ESM-only build and dropping support for older Node.js versions. The update introduces GraphQL subscription support and a new socket-based network interception algorithm for Node.js, allowing for deeper protocol handling.