-
-
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
make jsdom accessible to extending environments #12232
Conversation
I guess that would introduce whatever the previous PR fixed. I'll create an issue instead first. |
334b1a0
to
48fb7f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
you also need to move https://github.com/facebook/jest/blob/df0c496fa2b39293c26967f66bada30c3dcfd3c4/packages/jest-environment-jsdom/package.json#L30 to dependencies
and add a changelog entry 🙂
48fb7f7
to
34a39d9
Compare
34a39d9
to
6b19d6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
@SimenB thanks for the guidance and review! 🙌 |
9f448d2
to
1135197
Compare
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes: #12233
I initially wanted to create an issue, but thought it may be better if I opened a PR. Please let me know if you'd rather have me open an issue.
In f9814d2
dom
has been made private.This causes extending environments that depend on
this.dom
being available like jest-environment-jsdom-global to break if they use TypeScript.The error you get if you try to access
this.dom
in an environment:I prepared a small reproduction repository.
It uses a custom TS environment that tries to access
this.dom
and fails.To see for yourself:
npm install
npx jest
jest-environment-jsdom-global
itself is actually unaffected because it uses JS and the transpiled CommonJS version ofjest-environment-jsdom
doesn't enforcethis.dom
to be private. Ifjest
changes its bundling process in the future, this could also fail for projects using JS.I think it'd be great if
jsdom
continued to be accessible for custom environments since that enables use cases that would otherwise not be possible.