Neilk1021 opened a new pull request, #7999:
URL: https://github.com/apache/texera/pull/7999
### What changes were proposed in this PR?
`report-generation.service.spec.ts` drives the real html2canvas, which
clones the whole document
rather than the element it is pointed at. The unit-test builder runs spec
files with
`isolate: false`, so one jsdom document is shared by every spec file in a
worker and the clone
drags in whatever DOM the files before it left behind.
On the macOS runner that clone was measured at 12–37s against a 20s test
timeout, failing
`fails when the editor cannot be rendered` while ubuntu and windows passed
on the same commit.
Two changes, both test-only:
- **`report-generation.service.spec.ts`** — the snapshot suite parks the
document's existing body
nodes for the duration of the file and restores them after, so the
render's cost depends only on
the DOM these tests build. It spans the file rather than each test because
the renders outlive
the tests that start them (visible in the failing log: clone #1 finished
during test #3).
- **`jsdom-svg-polyfill.ts`** — stops jsdom announcing
`getComputedStyle(elt, pseudoElt)` and
`scrollTo` on the virtual console, which vitest forwards to
`console.error` as a full stack trace
per call. The failing job carried 5,691 of them for six renders. Dropping
`pseudoElt` changes no
behaviour: jsdom complains and then ignores the argument, returning the
element's own declaration
either way. `scrollTo` has nothing to move — jsdom has no layout, and the
one html2canvas reaches
for belongs to the throwaway clone iframe, so it is neutered as each
`contentWindow` is handed out.
### Any related issues, documentation, discussions?
Closes #7998.
This continues #7886 (closing #7887), which stopped the four image-inlining
tests in this file
waiting on the render. The flake moved to the two tests that still await one.
Scope note for reviewers: this bounds the render's cost, it does not remove
the dependency on a
real render. The two remaining tests still await html2canvas, so a
sufficiently loaded runner
could in principle still be slow — just not by the two orders of magnitude
measured here. Taking
#7886's logic to its conclusion (no test in this file waiting on a real
render) would need a
stub html2canvas that survives `isolate: false`, which is a larger change to
what those two tests
cover; happy to do that instead if reviewers prefer it.
Unrelated pre-existing noise left alone: a full run still emits ~827 jsdom
`HTMLCanvasElement.prototype.getContext` traces from
`JointUIService.getMeasureContext`
(`joint-ui.service.ts:219`). Silencing it would change what `measureText`
returns for the
joint-ui specs, so it is out of scope here.
### How was this PR tested?
`ng test --watch=false` on this branch (base `444fc58284`), five full runs:
201 files,
5131 passed / 1 skipped each time, no `Not implemented:
window.getComputedStyle` traces.
Clone time across the file's six renders stayed within 77–654 ms; the test
that was timing out
renders in 77–197 ms.
The effect of the console noise was measured directly by seeding the
document with 500 nodes:
clone time across the six renders went 18.8s → 13.1s with the polyfill
change alone (~30%; the
share is larger where console forwarding is slower, as on CI).
`yarn --cwd frontend format:ci` is clean.
I cannot demonstrate the macOS leg green from here — that needs CI on this
branch.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5 [1M context])
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]