instanceof filtering with multiple msw versions #2632
Replies: 3 comments
-
|
Hi, @meesvandongen. Thanks for raising this. Perhaps we can help with this kind of issues as well by setting a loose peer dependency version on packages like A pull request would be welcome here! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Worth nothing that we are moving away from instanceof checks in #2650 and will only rely on the handler's |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have recently come across an issue where we had multiple versions of MSW in a monorepo:
@msw/playwright@msw/playwrightdoes this at some point:If there are multiple RequestHandler declarations due to different versions being resolved, this check will fail even if the handler could be used as a request handler.
The behavior then is that it seems like msw is not intercepting anything; in my case this resulted in responses with status code 500 and an empty body.
I don't think this is necessarily a problem on
mswside; this discussion is simply to document the behavior. Users of monorepo's should probably use something (e.g. PNPM Catalogs) to prevent this type of issue.Beta Was this translation helpful? Give feedback.
All reactions