[CDX-398] Update Node version and packages#437
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Updates the repository’s Node/npm baseline and related dev dependencies to address vulnerabilities and accommodate Node 22 behavior changes in the test suite.
Changes:
- Bump
jsdomto v28 and update Volta-pinned Node/npm versions to Node 22 / npm 11. - Adjust
getWindowLocationunit test to rely on JSDOM URL parsing instead of stubbingwindow.location. - Remove
ReadableStreampolyfill wiring from Assistant/Agent streaming tests (relying on Node 22 Web Streams).
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
spec/src/utils/helpers.js |
Updates getWindowLocation test to align with modern JSDOM URL/location behavior. |
spec/src/modules/assistant.js |
Updates streaming tests to drop ReadableStream polyfill setup and modifies global/window SSE setup. |
spec/src/modules/agent.js |
Same as Assistant: updates streaming tests and global/window SSE setup. |
package.json |
Bumps jsdom and updates Volta-pinned Node/npm versions. |
package-lock.json |
Lockfile regeneration reflecting the dependency and engine changes from the jsdom upgrade. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| beforeEach(() => { | ||
| global.EventSource = EventSource; | ||
| global.ReadableStream = ReadableStream; | ||
| window.EventSource = EventSource; | ||
| window.ReadableStream = ReadableStream; | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| delete global.EventSource; | ||
| delete global.ReadableStream; | ||
| delete window.EventSource; | ||
| delete window.ReadableStream; | ||
| }); |
There was a problem hiding this comment.
In this test block, global.EventSource is overwritten in beforeEach but never restored. Under Node 22, EventSource may already exist on global, and jsdom-global cleanup will not delete it (it only cleans keys that weren’t present on the first run). This can leak the polyfill into later tests or mask the native implementation. Save the prior value of global.EventSource/window.EventSource and restore it in afterEach (or delete only if it was originally undefined).
| beforeEach(() => { | ||
| global.EventSource = EventSource; | ||
| global.ReadableStream = ReadableStream; | ||
| window.EventSource = EventSource; | ||
| window.ReadableStream = ReadableStream; | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| delete global.EventSource; | ||
| delete global.ReadableStream; | ||
| delete window.EventSource; | ||
| delete window.ReadableStream; | ||
| }); |
There was a problem hiding this comment.
In this test block, global.EventSource is overwritten in beforeEach but never restored. If Node provides a native EventSource (or if another suite sets one), this can leak the polyfill across tests and make later suites depend on ordering. Capture the previous global.EventSource/window.EventSource values and restore them in afterEach (or delete only if they were originally undefined).
| "volta": { | ||
| "node": "18.13.0", | ||
| "npm": "8.19.3" | ||
| "node": "22.18.0", | ||
| "npm": "11.0.0" | ||
| } |
There was a problem hiding this comment.
The PR updates Volta to Node 22 / npm 11, but the repo still pins Node 18 elsewhere (e.g., .github/workflows/* matrices and scripts/verify-node-version.sh which hard-codes the active LTS codename to "Hydrogen"). With jsdom@28 requiring Node >=20, CI and the npm run version workflow will fail unless those Node-version checks are updated to match the new baseline.
Alexey-Pavlov
left a comment
There was a problem hiding this comment.
Hey @esezen! It looks like tests are failing there 👀
Wanted to ask you, in this PR, do we need to update Node version from 18.13.0 to 22.18.0 in these 6 workflow files:
- .github/workflows/run-tests.yml
- .github/workflows/run-tests-bundled.yml
- .github/workflows/run-lint.yml
- .github/workflows/run-diffend.yml
- .github/workflows/run-license-check.yml
- .github/workflows/spell-check.yml
And update scripts/verify-node-version.sh to use "Jod" (Node 22 LTS codename) instead of "Hydrogen" (Node 18)? WDYT?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Code Review: [CDX-398] Update Node version and packagesFiles Reviewed: 14 files, +754/-855 lines P1 Critical Issues (0 found)No critical issues found. P2 Important Issues (2 found)Pinned Node 18 for Diffend — Needs a Follow-up Ticket or Comment
Workflow Action Versions Not Updated Alongside Node Bump
P3 Suggestions (3 found)
StrengthsThe primary goal of this PR — upgrading jsdom from v16 to v28 and Node from 18 to 22 — is well-executed. The dependency removals are correct (deprecated packages like Overall Assessment: APPROVED The changes are technically sound and achieve their stated goal. The two P2 items (Diffend follow-up and workflow action version consistency) are housekeeping improvements that can be addressed in a follow-up PR rather than blocking this one. |
|
@Alexey-Pavlov thanks for catching that! I forgot to update the versions in the workflows. I removed check Node version script completely since Volta takes care of that now. I also had to leave Diffend at the existing version since there seems to be a compatibility issue between Diffend and Node 22. |
Alexey-Pavlov
left a comment
There was a problem hiding this comment.
Thanks so much for the updates, @esezen! Everything's passing now, so it looks great!
Updated Node version to resolve vulnerabilities. Tests needed some updates because Node 22 handles some things differently than 18