unstale

npm / msw

msw

What changed in msw 1 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-26.

35 breaking17 new APIs and options5 behavior and defaults2 tooling49 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

msw 339 changes

Breaking changes 15

  • The Content-Length request header is removed by bypass().

    3.0.0release notes

  • MSW no longer manages cookies in Node.js; cookie behavior follows the environment default. Browser behavior is unchanged.

    3.0.0release notes

  • The defineNetwork() API is the replacement for the removed handleRequest() utility.

    3.0.0release notes

  • MSW is now ESM-only, affecting how projects load and bundle the package.

    3.0.0release notes

  • MSW no longer patches setTimeout; advance fake timers normally for delayed mocked responses to resolve.

    3.0.0release notes

  • file:// requests now throw in Node.js, matching fetch behavior because fetch does not support them.

    3.0.0release notes

  • GraphQLLinkHandlers is renamed to GraphQLLink.

    3.0.0release notes

  • The handleRequest() utility is removed; use defineNetwork() instead.

    3.0.0release notes

  • Upgrade requests made via fetch() now throw in Node.js, matching fetch behavior because fetch does not support them.

    3.0.0release notes

  • The msw/native entrypoint is removed in favor of @msw/react-native.

    3.0.0release notes

  • The minimal supported Node.js version is v22; Node.js v18 and v20 support is deprecated.

    3.0.0release notes

  • The onUnhandledRequest option is renamed to onUnhandledFrame.

    3.0.0release notes

  • This now returns null in handlers in all environments; use the cookies resolver argument for cookie-based logic.

    3.0.0release notes

  • TypeScript 5.9 is the minimum supported version; support for 5.1 and 5.2 is deprecated, and versions 6.0 and 7.0 are supported.

    3.0.0release notes

  • The WebSocket connection life cycle event is renamed from connection to websocket:connection.

    3.0.0release notes

New APIs and options 7

  • GraphQL is exported from msw/graphql and handled as an optional peer dependency.

    3.0.0release notes

  • MSW now supports GraphQL subscriptions.

    3.0.0release notes

  • MSW now supports GraphQL v17.0.

    3.0.0release notes

  • Import individual utilities such as delay or passthrough from msw/utils for a smaller bundle footprint.

    3.0.0release notes

  • MSW can now intercept page navigations and form submissions.

    3.0.0release notes

  • A new WebSocket life cycle event lets consumers listen to connection errors.

    3.0.0release notes

  • A new WebSocket Extension API enables better custom experiences.

    3.0.0release notes

Behavior and default changes 2

  • Intercepted request headers can now be modified in passthrough scenarios.

    3.0.0release notes

  • worker.stop() now returns a Promise; awaiting it matters only in in-flight critical scenarios.

    3.0.0release notes

Tooling 2

Fixes and other changes 13

  • Optional path parameters and pipes are preserved in handler paths.

    3.0.6release notes

  • The request:match event now includes handler.

    3.0.5release notes

  • Adds ico to the common assets recognized by isCommonAssetRequest.

    3.0.4release notes

  • Prevents the worker from going idle.

    3.0.4release notes

  • Network sources expose network context on enable.

    3.0.3release notes

  • Reset handlers are disposed of when reset, preventing them from remaining active.

    3.0.3release notes

  • Supports virtual:msw imports in Vitest.

    3.0.2release notes

  • Treats CONNECT requests as the transport mechanism.

    3.0.1release notes

  • Fixed localStorage cookie persistence causing maximum quota exceeded errors.

    3.0.0release notes

  • Fixed in-flight requests being incorrectly passed through when performed before calling worker.stop().

    3.0.0release notes

  • Various issues related to network interception in Node.js are fixed.

    3.0.0release notes

  • MSW now supports Node.js v24 and v26.

    3.0.0release notes

  • Preventing page closure via a beforeunload listener no longer unregisters the MSW worker.

    3.0.0release notes

msw 266 changes

Breaking changes 17

  • In Node.js, toPublicUrl now removes search parameters.

    2.12.3release notes

  • The browser and react-native export conditions are ordered lower, changing package export resolution.

    2.12.2release notes

  • The compose export is removed.

    2.0.0release notes

  • The context export and related defaultContext, restContext, and graphqlContext exports are removed.

    2.0.0release notes

  • The createResponseComposition export is removed.

    2.0.0release notes

  • The rest object is renamed to http, so request handlers use http.get instead of rest.get.

    2.0.0release notes

  • The Life-cycle Events API now accepts a single object argument.

    2.0.0release notes

  • listHandlers replaces the .printHandlers() method.

    2.0.0release notes

  • Browser-side exports such as setupWorker and SetupWorkerApi must now be imported from msw/browser.

    2.0.0release notes

  • The NetworkError class is removed in favor of the standard Response.error().

    2.0.0release notes

  • Node.js 16 is no longer supported; use Node.js 18 or later for the global Fetch API.

    2.0.0release notes

  • Intercepted requests are represented as Fetch API Request instances.

    2.0.0release notes

  • The { once: boolean } request handler option replaces res.once() and allows a network error to be mocked once.

    2.0.0release notes

  • The response export is removed.

    2.0.0release notes

  • Resolvers now receive a single object containing request and return a Response, replacing the (req, res, ctx) => res() signature.

    2.0.0release notes

  • Mocked responses are represented as Fetch API Response instances.

    2.0.0release notes

  • TypeScript versions earlier than 4.7 are no longer supported.

    2.0.0release notes

New APIs and options 10

  • Adds the finalize API for handler cleanup.

    2.14.4release notes

  • Support handling connection upgrades with ws.onUpgrade.

    2.14.0release notes

  • Adds a public test() method to WebSocketHandler.

    2.13.6release notes

  • Use the network source architecture through defineNetwork.

    2.13.0release notes

  • Exports the AnyHandler type for developers to use.

    2.12.10release notes

  • Exports the GraphQLLinkHandlers type for use by developers.

    2.12.7release notes

  • Adds support for server-sent events (SSE).

    2.12.0release notes

  • Intercepted request bodies can be read as FormData.

    2.0.0release notes

  • FormData is supported as a mocked response body.

    2.0.0release notes

  • ReadableStream is supported as a mocked response body.

    2.0.0release notes

Behavior and default changes 3

  • The SSE response stream now invokes finalize when it ends.

    2.15.0release notes

  • Request error handling moves from the worker thread to the client thread.

    2.0.0release notes

  • The RequestHandler API is now public.

    2.0.0release notes

Fixes and other changes 36

  • Logging for concurrent requests is now handled properly.

    2.14.7release notes

  • Prevents event forwarding manually.

    2.14.6release notes

  • All frame listeners are removed when the client closes.

    2.14.5release notes

  • Prevents a frame abort listener leak.

    2.14.3release notes

  • Exports the NetworkApi type so developers can use it.

    2.14.2release notes

  • Fixes exporting default handler controllers.

    2.14.1release notes

  • Cookies are forwarded only when the response is used.

    2.14.0release notes

  • User-provided responses are no longer cloned.

    2.14.0release notes

  • Generator state is reset when .resetHandlers() or .restoreHandlers() is called.

    2.13.5release notes

  • The underlying SSE stream now respects request.signal, allowing request cancellation to affect the stream.

    2.13.4release notes

  • Prevent infinite mode from throwing.

    2.13.2release notes

  • Life-cycle events are now annotated correctly.

    2.13.1release notes

  • WebSocket connections are no longer logged in the console when there are no matching event handlers.

    2.13.0release notes

  • URL matching now supports wildcard ports.

    2.12.14release notes

  • GraphQL supports responses with the application/graphql-response+json content type.

    2.12.13release notes

  • The postinstall script now handles special characters, preventing installation issues in environments where they occur.

    2.12.12release notes

  • In Node.js, infinite delays no longer leave open handles.

    2.12.11release notes

  • ws.link supports relative URLs.

    2.12.9release notes

  • Updated the interceptors dependency to fix a memory leak.

    2.12.8release notes

  • Supports TypedDocumentString as a request predicate.

    2.12.7release notes

  • The SSE worker now respects the quiet option.

    2.12.6release notes

  • Server-Sent Events now handle multi-line messages.

    2.12.5release notes

  • Handles incomplete localStorage in Node.js v25.

    2.12.4release notes

  • Types used in HttpHandler are now published for developers to use.

    2.12.3release notes

  • Fixes response init in response:* events.

    2.12.1release notes

  • A File polyfill is used in Node.js.

    2.0.0release notes

  • Fixes an issue preventing request bodies from being properly read as FormData.

    2.0.0release notes

  • Fixes response patching issues when using a FormData response body.

    2.0.0release notes

  • Includes various improvements in Node.js network behavior compliance.

    2.0.0release notes

  • A bypassed request's referrerPolicy is no longer reset to a different value than the original.

    2.0.0release notes

  • Fixes the order of XMLHttpRequest events and readyState changes.

    2.0.0release notes

  • Fixes an issue that caused the onload event callback to be called twice.

    2.0.0release notes

  • Reading an XMLHttpRequest body with responseType arraybuffer no longer produces an incorrect buffer by assuming the body is a string.

    2.0.0release notes

  • XMLHttpRequest status remains 0 until the request actually resolves.

    2.0.0release notes

  • XMLHttpRequest upload events are supported when responding with a mocked stream response.

    2.0.0release notes

  • Fixes the order of XMLHttpRequest events when the request fails.

    2.0.0release notes

msw 13 changes

Breaking changes 3

  • Renames the SetupServerApi type to SetupServer.

    1.0.0release notes

  • Renames the SetupWorkerApi type to SetupWorker.

    1.0.0release notes

  • For React Native, throws and suggests a URL polyfill.

    1.0.0release notes