This recipe is a set of codemods that will upgrade your project from using msw v1 to v2.
The recipe includes the following codemods:
- imports
- type-args
- request-changes
- ctx-fetch
- req-passthrough
- response-usages
- callback-signature
- lifecycle-events-signature
- print-handler
FNs
This 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:
ts
Also, 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.