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