mswjs / interceptors

Low-level network interception library.
https://npm.im/@mswjs/interceptors
MIT License
565 stars 127 forks source link

`globalThis.WebSocket` is undefined and it can't be proxied. #668

Closed Afsoon closed 3 weeks ago

Afsoon commented 3 weeks ago

Hello

Our current dependanbot PR is failing with the latest MSW version, after debugging and tracking changes in the repository I have conclude the following:

Our setup is Vitest + Happy-DOM + Remix, I have tested prior version of MSW, and it didn't have this problem.

I'm not 100% sure of the fix, but I think it's a missing a check that is:

  if (typeof descriptor.get() === "undefined") {
    return false;
  }

If it's the fix, I can create a PR with the test.

kettanaito commented 3 weeks ago

Hi, @Afsoon. Thanks for reporting this.

Let's discuss it first. Just checking the getter not being there isn't enough—the property descriptor can have a value and no get, and that's a valid property that must return true. Will look at your pull request in more detail once I have a moment (thanks for opening that btw!).

kettanaito commented 3 weeks ago

Released: v0.36.8 🎉

This has been released in v0.36.8!

Make sure to always update to the latest version (npm i @mswjs/interceptors@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.