Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-2958]): polyfill jsdom scrollIntoView in client test setup

[._.]/ Adam Eivyc00d93a43b05
diff --git a/client/src/test/setup.js b/client/src/test/setup.js
index 1d45df82db..bfb630df56 100644
--- a/client/src/test/setup.js
+++ b/client/src/test/setup.js
@@ -7,6 +7,15 @@ import { installTestStorage } from './storagePolyfill.js';
// of how jsdom exposes Storage in this environment. See storagePolyfill.js / #1438.
installTestStorage();
+// jsdom doesn't implement Element.prototype.scrollIntoView; components call it
+// (often from a requestAnimationFrame callback that can fire AFTER a test unmounts),
+// and the resulting unhandled error fails the whole run despite passing assertions
+// (#2958). Stub it once, guarded so it never clobbers a real implementation — on real
+// DOM elements scrollIntoView is always present, so production is unaffected.
+if (!Element.prototype.scrollIntoView) {
+ Element.prototype.scrollIntoView = () => {};
+}
+
// Fail any test that triggers React's "not wrapped in act(...)" warning (#2406).
// These mark unsettled async state updates — usually a mount-effect fetch whose
// mocked promise resolves after the sync test body — which vitest hides locally