msw
3.0.7 · 18 Nov 2026MIT36M / weekRepositoryHomepagenpmAtom feed
0.49.3 is the newest release of 0.27.x.
In short
2 breaking3 new2 fixed6 changed2 internal
- Breaking
The Promise returned by
worker.start()will now reject in the case of any errors during the worker registration (#607). - Breaking
The values of the
MockedRequesttype no longer have theparamskey (#561). Please use theRestRequesttype to annotate REST API requests instead.
Release note
Breaking changes
- Breaking
The Promise returned by
worker.start()will now reject in the case of any errors during the worker registration (#607). - Breaking
The library no longer exports the following TypeScript declarations:
RestRequestType, useRestRequestinstead.GraphQLMockedRequest, useGraphQLRequestinstead.GraphQLMockedContext, useGraphQLContextinstead.GraphQLRequestPayload, useGraphQLRequestBodyinstead.GraphQLRequestParsedResult, useParsedGraphQLRequestinstead.GraphQLResponseResolver
- Breaking
The values of the
MockedRequesttype no longer have theparamskey (#561). Please use theRestRequesttype to annotate REST API requests instead.
Features
Supports automatic worker script updates (#606). Respects the
msw.workerDirectoryproperty in your package.json:
{
"msw": {
"workerDirectory": "public"
}
}Starting from this release, whenever you install msw, it will try to locate the msw.workerDirectory property in your package.json and copy the relevant worker script (mockServiceWorker.js) to that directory.
Whenever running msw init now, you will be prompted to save your public directory choice to package.json.
When running
msw inityou can pass the—saveoption to automatically save the public directory in your package.json for future worker updates (#606). You can alternatively use--no-saveto bail out this step.Intercepts requests originating from an iframe (#589).
Adds virtual cookie store to ensure the persistency of cookies received from the same domains across multiple requests (#435, #469).
Bug fixes
Fixes an issue when a request body type generic had no effect on the response composition chain validation.
Fixes an issue when a 204 response threw an exception when the library emitted its
response:*life-cycle events (#570).
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.