Merge pull request #488 from StroepWafel/patch-6

Update jest.setup.ts
This commit is contained in:
Aden Lindsay authored and GitHub committed 2026-09-07 16:45:12 +09:30
commit c1151cf501
1 file changed
+16
+16
View File
@@ -11,6 +11,22 @@ if (typeof globalThis.CSS === "undefined") {
});
}
// requestAnimationFrame / cancelAnimationFrame polyfill
// SettingsState.ts calls requestAnimationFrame to batch subscriber
// notifications, but that API doesn't exist under the Node test
// environment. This provides a minimal setTimeout-based stand-in.
if (typeof globalThis.requestAnimationFrame === "undefined") {
globalThis.requestAnimationFrame = (cb: FrameRequestCallback): number => {
return setTimeout(() => cb(Date.now()), 0) as unknown as number;
};
}
if (typeof globalThis.cancelAnimationFrame === "undefined") {
globalThis.cancelAnimationFrame = (handle: number): void => {
clearTimeout(handle);
};
}
afterEach(() => {
__resetBrowserStorageMock();
});