mswjs / jest-fixed-jsdom

A superset of the JSDOM environment for Jest that respects Node.js globals.
https://npm.im/jest-fixed-jsdom
51 stars 5 forks source link

fix: support native `URLSearchParams` #15

Closed jiri-prokop-pb closed 1 month ago

jiri-prokop-pb commented 1 month ago

While migrating to MSW v2 we had strange, seemingly unrelated, failure in one of our tests.

After some debugging it turned out it's related to jest-fixed-dom replacing URL with native one. I don't know why exactly it's broken but I provided a test and you can check this on your own, if you are interested.

Basically, if you mock methods on URLSearchParams and then you access it through URL.searchParams, the mock won't work. By just simply adding this.global.URLSearchParams = URLSearchParams it will start working.

kettanaito commented 1 month ago

Released: v0.0.6 🎉

This has been released in v0.0.6!

Make sure to always update to the latest version (npm i jest-fixed-jsdom@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.