Use msw v2.x with next/experimental/testmode/playwright
.
#63251
uzimaru0000
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
msw's v2.x contains breaking changes and is not compatible with v1.x.
Since
testmode/playwright/msw
depends on v1.3.0, handlers that have already been implemented in v2.x cannot be used.I would like to make these usable.
Non-Goals
No response
Background
If the msw already included in the project for use in unit tests etc. is v2, using handlers implemented with it results in an error:
TypeError: _msw.MockedRequest is not a constructor
.This seems to be an error caused by using
MockedRequest
, which is an API from v1.x, in v2.x.Provide environment information
Proposal
By creating a fixture as follows, I was able to support v2 as well.
Beta Was this translation helpful? Give feedback.
All reactions