Closed ericchernuka closed 9 months ago
It's a bit difficult to reason about what requests are meant as your app's network and what are the implementation detail of your framework. I think what MSW can do is ignore requests with the node_modules
in the request URL by default. Even that isn't a reliable strategy as it potentially collides with a regular request containing that phrase.
MSW will ignore file://
requests when warning you about unhandled requests. Implemented in #1997.
This has been released in v2.1.5!
Make sure to always update to the latest version (npm i msw@latest
) to get the newest features and bug fixes.
Predictable release automation by @ossjs/release.
Prerequisites
Environment check
msw
versionNode.js version
18.16.0
Reproduction repository
https://github.com/ericchernuka/examples-new/blob/repro-vitest-msw-warnings/examples
Reproduction steps
I've set up the examples-new repo
with-remix
so that it mimics a lot of what we've seen lately at my organization. Running thepnpm test
withinexamples/with-remix
will throw errors related to paths that don't seem related to my tests.Current behavior
I noticed this happened when I made this line, https://github.com/ericchernuka/examples-new/blob/repro-vitest-msw-warnings/examples/with-remix/app/routes/_index.tsx#L33, use the
json
return type from Remix rather than just an object like it is in the original repo. Removingjson
should pass without errors, but withjson
, it throws errors.This also includes the
unstable_createRemixStub
from@remix/testing
, which from the source doesn't seem to do anything other than wire up so that it'll mimic Remix.I also had similar errors with Kent's
rocket-rentals
repo, https://github.com/epicweb-dev/rocket-rental/issues/17, where I saw file system items being logged.I'm bringing this up as I've noticed that CPU/memory seem too high that I have to force quit node after running test tests in watch mode, so I wasn't entirely sure if something causing these additional warnings was further making the test runner unresponsive.
Lastly, when we switched to
happy-dom
many of the errors seem to go away, but if the test had an error in it, it wasn't typical Vitest errors and instead the ones this repo seemed to be showing which makes testing quite hard.Expected behavior