From f41fce6c68a22571f141dc9b965adaa2d33f8dc9 Mon Sep 17 00:00:00 2001 From: Pixnop <77785313+Pixnop@users.noreply.github.com> Date: Sun, 30 Aug 2026 00:48:17 +0200 Subject: [PATCH] test(renderer): stub window.scrollTo so the DOM suite runs stderr-clean jsdom defines window.scrollTo as a stub that logs "Not implemented: Window's scrollTo() method" instead of doing anything, so every call lands on stderr. motion/react calls it while resolving a height: "auto" keyframe, which DropdownSection animates on open and close, and a full test:coverage run printed the line twice with nothing failing. Overwrite it in the renderer-dom setup file, next to the existing Element.prototype.scrollTo stub. Nothing under test depends on the page having scrolled, and a quiet run means a real warning is visible. --- tests/renderer-dom/setup.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/renderer-dom/setup.ts b/tests/renderer-dom/setup.ts index a9d885ff..131ca16e 100644 --- a/tests/renderer-dom/setup.ts +++ b/tests/renderer-dom/setup.ts @@ -35,6 +35,15 @@ if (!Element.prototype.scrollTo) { Element.prototype.scrollTo = (): void => {} } +// jsdom does define window.scrollTo, but only as a stub that logs "Not +// implemented: Window's scrollTo() method" to stderr on every call, so this +// one has to be overwritten rather than guarded on. motion/react reaches it +// while resolving a height: "auto" keyframe (DropdownSection's open/close +// animation, on the info and help page among others): it parks the page +// scroll, measures, then puts the scroll back. Nothing under test depends on +// the page having scrolled, and the noise buries real warnings. +window.scrollTo = (): void => {} + // jsdom does not implement IntersectionObserver. motion/react's useInView // (every GridItem card) reads it on mount; missing it throws during the // commit phase and takes the whole subtree down with it, with no error