Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support native URLSearchParams #15

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

jiri-prokop-pb
Copy link
Contributor

@jiri-prokop-pb jiri-prokop-pb commented Oct 3, 2024

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.

Copy link
Member

@kettanaito kettanaito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@kettanaito kettanaito merged commit cd24594 into mswjs:main Oct 21, 2024
1 check failed
@kettanaito
Copy link
Member

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.

@jiri-prokop-pb jiri-prokop-pb deleted the fix-url-search-params branch October 21, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants