MSW v2 brings the biggest API change to the library since its inception. Alongside the new API, it includes various features, such asDocumentation Index
Fetch the complete documentation index at: https://docs.codemod.com/llms.txt
Use this file to discover all available pages before exploring further.
ReadableStream support, ESM-compatibility, and countless bug fixes.
Codemod supports a mostly automated MSW v2 upgrade experience. This page provides tips and resources you may need for a successful migration.
Getting started
MSW v2 Upgrade Guide
MSW v2 Upgrade Recipe
Migration Steps
Run codemods
Inside your project’s root directory, run the MSW v2 upgrade recipe:
Fix false negatives
The upgrade recipe does not change the signatures of MSW handlers, if they were called using a custom factory function, for example to provide more type-safety or else. For example, the following code will only be partially updated:Additionally, if you were using
req.body in your interceptors, this codemod will blindly assume you want await request.json() instead of any other type. You will have to correct that manually.