From 2038028d42ab5890d2cdf6fd87614805d77ab9b3 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 22 Jul 2026 21:27:35 -0400 Subject: [PATCH] =?UTF-8?q?test(web):=20no-op=20scrollIntoView=20in=20vite?= =?UTF-8?q?st=20setup=20(jsdom=20lacks=20it)=20=E2=80=94=20#1931?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The queue auto-scroll $effect calls scrollIntoView on render, and jsdom doesn't implement it, so QueueDrawer.test.ts threw an unhandled TypeError that failed the run even though every assertion passed. Polyfill it as a no-op in the shared setup; tests never assert on scroll position. Co-Authored-By: Claude Opus 4.8 (1M context) --- web/vitest.setup.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/vitest.setup.ts b/web/vitest.setup.ts index 883d6851..8f28a4de 100644 --- a/web/vitest.setup.ts +++ b/web/vitest.setup.ts @@ -37,6 +37,14 @@ if (typeof window !== 'undefined') { Object.defineProperty(window, 'sessionStorage', { configurable: true, value: memSession }); } +// jsdom doesn't implement Element.prototype.scrollIntoView. Components that +// call it (queue auto-scroll to the now-playing row, the alphabetical rail) +// would throw an unhandled TypeError in tests — which fails the run even when +// every assertion passes. No-op it; tests never assert on scroll position. +if (typeof Element !== 'undefined' && !Element.prototype.scrollIntoView) { + Element.prototype.scrollIntoView = () => {}; +} + // W-T3 moved toast rendering out of per-page markup into a single // mounted in +layout.svelte. Tests render individual pages // without the layout, so we mount ToastHost here so `pushToast()` calls