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

[scoped-custom-element-registry] Add basic jsdom tests #530

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

bicknellr
Copy link
Collaborator

@bicknellr bicknellr commented Oct 24, 2022

jsdom currently has a bug where it reads the global custom elements registry by looking through the sandbox-facing customElements property of its global object. This means that scripts running in that context can break jsdom's custom elements implementation by overwriting or deleting the customElements global.

I'm making a PR to fix jsdom upstream. Once jsdom and jest-environment-jsdom are released with updated versions, these tests should pass.

Closes #459.

@bicknellr bicknellr changed the title [scoped-custom-element-registry] Add basic jsdom tests [scoped-custom-element-registry] Add basic jsdom tests Oct 27, 2022
@bicknellr
Copy link
Collaborator Author

jsdom 20.0.2 contains the PR with the fix. jest-environment-jsdom depends on jsdom@^20.0.0 so its not guaranteed to use 20.0.2. Adding jsdom@^20.0.2 as a dev dependency here would satisfy node's deduping during installation of jest-environment-jsdom, but I don't think it's a great idea to rely on that behavior so I'll keep this open until it depends on at least 20.0.2.

@bicknellr
Copy link
Collaborator Author

Adding jsdom@^20.0.2 as a dev dependency here would satisfy node's deduping during installation of jest-environment-jsdom

I'm trying this out here: 39e3f06

@bicknellr
Copy link
Collaborator Author

bicknellr commented Oct 31, 2022

Except for the formatting, the tests passed on that commit. I reformatted and pushed here. (These still won't pass until jest-environment-jsdom is updated.)

@bicknellr
Copy link
Collaborator Author

Added "Skip Changelog" label because there are no user-facing changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[scoped-custom-element-registry]: Support for JSDOM (Jest)
1 participant