msw
3.0.7 · 18 Nov 2026MIT36.1M / weekRepositoryHomepagenpmAtom feed
3.0.7 is the newest release of 3.x.
In short
15 breaking2 deprecated11 new4 fixed6 changed
- Breaking
MSW is now ESM-only (#2765).
- Breaking
msw/nativeis removed in favor of@msw/react-native. - Breaking
Require TypeScript 5.9 as the minimal version.
- Breaking
worker.stop()returns a Promise (#2724). Awaiting it is relevant only for in-flight critical scenarios. - Breaking
graphqlis now exported asmsw/graphql(#2691). GraphQL is now handled as a proper optional peer dependency. - Breaking
Removes the
handleRequest()utility. Please use thedefineNetwork()API instead. - Breaking
GraphQLLinkHandlerstype has been renamed toGraphQLLink. - Breaking
The
file://requests now throw in Node.js as they normally do (not supported byfetch).
Release note
v3.0.0 (#2692) (2bb4342) @kettanaito @Andarist
Breaking changes
- Breaking
MSW is now ESM-only (#2765).
- Deprecated
Deprecate support for Node.js v18 and v20 (#2729). The minimal supported Node.js version is v22.
- Breaking
msw/nativeis removed in favor of@msw/react-native. - Breaking
Require TypeScript 5.9 as the minimal version.
- Deprecated
Deprecate support for TypeScript 5.1 and 5.2
- Breaking
worker.stop()returns a Promise (#2724). Awaiting it is relevant only for in-flight critical scenarios. - Breaking
graphqlis now exported asmsw/graphql(#2691). GraphQL is now handled as a proper optional peer dependency. - Breaking
Removes the
handleRequest()utility. Please use thedefineNetwork()API instead. - Breaking
GraphQLLinkHandlerstype has been renamed toGraphQLLink. - Breaking
The
file://requests now throw in Node.js as they normally do (not supported byfetch). - Breaking
The
Content-Lengthrequest header is now removed bybypass(). - Breaking
HTTP-to-WebSocket upgrade requests performed via
fetch()now throw in Node.js as they normally do (not supported byfetch). - Breaking
Cookies are no longer managed in Node.js for better compatibility. Instead, whatever is the default behavior of your environment that's the cookie behavior you get. This has no effect on the browser.
- Breaking
WebSocket
connectionlife cycle event has been renamed towebsocket:connection(#2783). - Breaking
onUnhandledRequestoption has been renamed toonUnhandledFrame. - Breaking
The library no longer patches
setTimeoutto circumvent fake timers in test runners. You should advance the fake timers normally for delayed mocked responses to resolve. - Breaking
The library no longer returns a mocked cookie string on
request.headers.get('cookie')in the handlers. It returnsnullin all environments. Please use thecookiesresolver argument to have cookie-based logic.
Features
Supports Node.js v24 and v26.
Supports TypeScript v6.0 and v7.0.
You can import individual utilities, like
delayorpassthrough, from the newmsw/utilsentrypoint for smaller footprint on your bundle.Support GraphQL v17.0.
Support intercepting page navigations and form submissions (#2721).
Remove the following dependencies:
graphqlpath-to-regexppicocolorsstatusesstrict-event-emitter
Adds a Vite plugin for MSW (#2781).
Adds a
websocket:errorlife cycle event to listen to WebSocket connection errors (#2784).Support modifying the intercepted request headers in passthrough scenarios (#2786).
Support a new WebSocket Extension API that allows for better custom experiences (#2791).
Bug fixes
Fix an issue where preventing a page closure via the
beforeunloadlistener would unregister the MSW worker (#1105).Fix an issue that caused intermittent test failures in Vitest Browser Mode and Firefox if using
maxWorkers: 1(#2726).Fix an issue where in-flight requests were incorrectly passthrough when performed before calling
worker.stop()(#2724, #2597).Fix an issue where persisting cookies in
localStoragewould cause a maximum quota exceeded errors.Fix various issues related to the network interception in Node.js.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.