Repository navigation
fix: make Iterator polyfill cover jsdom vm contexts and spawned child processes - #7445
Conversation
… processes The polyfill from #7443 fixed the worker-global Iterator but left two failure modes that the prow presubmit (which never ran on #7443's scripts-only diff) exposed on the next PR (#7440): 1. jsdom >= 30 creates each window as a fresh vm context and reads every JS global out of it with vm.runInContext(name, window). The fresh context on Node 20 has no Iterator, so window creation throws "ReferenceError: Iterator is not defined" and every jsdom-environment test file fails to start. The polyfill now wraps vm.createContext to mirror the polyfilled Iterator into each new context. 2. NODE_OPTIONS carried a cwd-relative --require path, which each child node process resolves against ITS cwd. Script tests that spawn node with a tmpdir cwd (check-leaderboard-regression, release-version, ci-observability reporter — 30 failing tests) died at startup with MODULE_NOT_FOUND / exit 1. The polyfill now rewrites NODE_OPTIONS to its own absolute path so inherited environments work from any cwd. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <scanner@hive.kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellar-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @hivecommons-hive[bot]. Thanks for your PR. I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88 |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
#7447) jsdom 30's Document-impl.js close() calls the ES2024 Promise.withResolvers (native only in Node >= 22). On the Node 20 prow presubmit image every jsdom worker teardown crashed with 'TypeError: Promise.withResolvers is not a function' — 74 unhandled errors, exit 1 — once the Iterator polyfill (#7445) stopped masking it. Install the polyfill on the host realm and mirror it into jsdom's per-window vm contexts. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes #7444
#7443's Node 20
Iteratorpolyfill left two failure modes that the prow presubmit (which never ran on #7443's scripts-only diff) exposed on #7440 (prow run 2111718441651015680: 30 failed tests, 3 jsdom test files unable to start):jsdom window contexts — jsdom 30 creates each window as a fresh vm context and installs every host JS global into it via
vm.runInContext(name, window)(lib/jsdom/browser/Window.js). A fresh context on Node 20 has noIterator, so window creation throwsReferenceError: Iterator is not defined. The polyfill now wrapsvm.createContextto mirror the polyfilled Iterator into each new context.Relative
--requirein NODE_OPTIONS —./scripts/node-iterator-polyfill.cjsresolves against each process's own cwd, so childnodeprocesses spawned by script tests from tmpdir cwds (check-leaderboard-regression, release-version, ci-observability reporter) died at startup with MODULE_NOT_FOUND / exit 1. The polyfill now rewritesNODE_OPTIONSto its own absolute path so inherited environments work from any cwd.On Node >= 22 both branches are no-ops (native Iterator is kept, vm.createContext is untouched).
— hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88