-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
jest-environment-jsdom should export jsdom globally #11001
Comments
Before it, maybe, it's help anyone.
You just need write in setupTests.js
|
This can't be used in an unejected CRA which is another unfortunate current circumstance |
I agree it's a bit of a pain for navigation, but IMO not enough to leak Jest's implementation details. If CRA doesn't allow you to use a custom env, I'd open up an issue with them |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
jest-environment-jsdom
should export jsdom globally.Motivation
Essentially because of all the hacks discussed in this thread and this thread to modify window.location. Being able to use the jsdom API's directly would be much more sensible that deleting location, object defining properties, etc.
Example
Pitch
Although typically changes to jsdom test environments are not normally approved this is a safe an innocuous change which would allow tests to use jsdom API correctly rather than having to hack in changes or use a custom environment for something which should already be exposed.
@cpojer has suggested this would be a sensible addition in the past.
Workaround
jest-environment-jsdom-global
already exists, but this should be part of core.The text was updated successfully, but these errors were encountered: