Packages

msw

3.0.7 · 18 Nov 2026MIT36.1M / weekRepositoryHomepagenpmAtom feed

Your version

2.3.0

8 May 2024Where it was published

2.15.0 is the newest release of 2.x.

In short

3 new1 fixed

Release note

Warning

This release changes how MSW treats unhandled exceptions in response resolvers. Previously, they were treated as request errors. Starting with this release, unhandled resolver exceptions will be coerced to 500 Unhandled Exception mocked error responses produced by the library. Please note that you must not intentionally throw errors in your resolvers. Please use Response.error() to mock request/network errors. Unhandled exceptions are considered unintended and will be treated as if they happen on the actual server.

Features

  • Treat unhandled exceptions in handlers as 500 error responses

  • Prioritize the node export when importing msw/node (#2134, transitively through @mswjs/interceptors).

  • Add a new unhandledException event (#2135, docs).

server.events.on('unhandledException', ({ request, error }) => {
  console.log('%s %s errored! See details below.', request.method, request.url)
  console.error(error)
})

Bug Fixes

  • Disposable: make the ".dispose()" method synchronous

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.