Repository navigation
Description
What happened?
build / frontend (macos-latest, 24.19.0) fails intermittently on:
FAIL src/app/workspace/service/report-generation/report-generation.service.spec.ts
> ReportGenerationService > generateWorkflowSnapshot > rendering the editor to a PNG
> fails when the editor cannot be rendered
Error: Test timed out in 20000ms.
The test had been running for 35,315 ms. ubuntu and windows pass on the same commit.
Cause. The spec drives the real html2canvas, which clones the whole document, not 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 that ran before it left behind. How much that is depends on which worker the file lands in
and what ran ahead of it, which is why the failure comes and goes and why only the slowest leg
trips the 20s timeout.
From a failing job's log, the six renders in that file reported:
#1 22076ms #2 19823ms #3 13024ms #4 16028ms #5 12116ms #6 37281ms Document cloned
against ~60 ms for the same file run on its own locally.
The same log carries 5,691 Not implemented: window.getComputedStyle(elt, pseudoElt) stack
traces. jsdom does not implement the pseudo-element argument, so it emits a jsdomError on the
virtual console (which vitest forwards to console.error as a full stack trace) and then ignores
the argument. html2canvas does a :before and an :after lookup per cloned node, so ~950 traces
per clone implies roughly 475 foreign elements in the document each time. The same run locally
emits 56. jsdom's unimplemented window.scrollTo adds one trace per clone on top.
This is a continuation of #7887 / #7886, which stopped the four image-inlining tests in this file
waiting on the render. The flake has moved to the two tests that still await one — and the four
renders those inlining tests start are not cancellable, so they run concurrently with them.
How to reproduce?
- Open any PR and let
build / frontend (macos-latest, 24.19.0)run; it fails on a portion of runs. - Locally, the mechanism can be shown by seeding the shared document before the render:
addfor (let i = 0; i < 500; i++) document.body.appendChild(document.createElement("span"));
to thebeforeEachof therendering the editor to a PNGdescribe and run
ng test --watch=false --include "**/report-generation.service.spec.ts".
Clone time across the file's six renders goes from ~0.5s to ~18.8s, with ~10,000 jsdom traces.
Version/Branch
1.3.0-incubating-SNAPSHOT (main)
Commit Hash (Optional)
What browsers are you seeing the problem on?
No response
Activity
fix(test, frontend): bound the workflow-snapshot render's cost under …