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

Use newer version of JSDOM #3979

Merged
merged 1 commit into from
Mar 31, 2025
Merged

Conversation

koesie10
Copy link
Member

To prepare for upgrading to @vscode-elements/elements, we need a newer version of JSDOM that better supports web components. This upgrades to a newer version of JSDOM by using a custom Jest environment that is available in Jest 30.

@koesie10 koesie10 force-pushed the koesie10/use-custom-jest-environment branch from 9914e32 to f0329a0 Compare March 31, 2025 09:01
@koesie10 koesie10 marked this pull request as ready for review March 31, 2025 10:48
@Copilot Copilot bot review requested due to automatic review settings March 31, 2025 10:48
@koesie10 koesie10 requested a review from a team as a code owner March 31, 2025 10:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the JSDOM version to support web components by switching to a custom Jest environment.

  • Updates jest.config.ts to use the custom environment
  • Introduces a new jest-environment-jsdom.ts file
  • Updates the dead code detection script to ignore the new environment file

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
extensions/ql-vscode/src/view/jest.config.ts Updates testEnvironment to point to the custom Jest environment file
extensions/ql-vscode/src/view/jest-environment-jsdom.ts Adds a custom Jest environment implementation using a newer JSDOM
extensions/ql-vscode/scripts/find-deadcode.ts Excludes the newly added Jest environment file from dead code detection
Files not reviewed (1)
  • extensions/ql-vscode/package.json: Language not supported

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

Copy link
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

LGTM if this helps us move forwards with the vscode/elements migration. Maybe it's not ideal being on an alpha version but given we only use it for testing it can hopefully only cause stability issues for us and not for users 🤷🏼

"jest-runner-vscode": "^3.0.1",
"jsdom": "^26.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at jest-environment-jsdom it seems we're going jsdom version 20 to 26.

Looking in the changelog I can't immediately see any references to the fields that weren't defined and were causing errors, but it could be I missed it or it's from another updated dependency 🤷🏼

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe what we're looking for is in version 23.1.0: "Added an initial implementation of ElementInternals, including the shadowRoot getter and the string-valued ARIA properties." This is what was giving errors when using some @vscode-elements/elements components (after fixing a missing CSSProperties.replaceSync definition).

@koesie10 koesie10 merged commit 86d4a80 into main Mar 31, 2025
31 of 32 checks passed
@koesie10 koesie10 deleted the koesie10/use-custom-jest-environment branch March 31, 2025 12: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.

2 participants