Packages

msw

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

Your version

0.40.0

17 May 2022Where it was published

0.49.3 is the newest release of 0.40.x.

In short

1 breaking6 new3 fixed

  • Breaking

    Returning undefined, or early returns, from response resolvers, now does not perform request as-is, and is instead treated as a handler that didn't do anything. Please return req.passthrough() if you wish to bypass a request.

Release note

Breaking changes

  • Breaking

    Returning undefined, or early returns, from response resolvers, now does not perform request as-is, and is instead treated as a handler that didn't do anything. Please return req.passthrough() if you wish to bypass a request.

rest.get('/resource', (req, res, ctx) => {
// I want to perform this intercepted request as-is.
-  return
+  return req.passthrough()
})

Features

  • Add "unhandledException" life-cycle event

  • Improve PathParams type to support interface

  • Rename "DefaultRequestBody" to "DefaultBodyType"

  • Add "req.passthrough"

  • Add service worker scope and worker script URL to "Mocking enabled" message

  • Set "typescript" optional peer dependency to 4.2.x

Bug Fixes

  • setupWorker: warn on multiple "worker.start" and "worker.stop" calls

  • Remove console.log from "setRequestCookies"

  • Set "credentials" to "same-origin" for "ClientRequest"

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.