From 62fed068a9b0650bd3852e2d6b998fe439852172 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 14:55:07 +0000 Subject: [PATCH] test: enable async leak detection in vitest config Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com> --- .../chat/chat/chat-input-area/__tests__/index.spec.tsx | 7 +++++-- web/vite.config.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/web/app/components/base/chat/chat/chat-input-area/__tests__/index.spec.tsx b/web/app/components/base/chat/chat/chat-input-area/__tests__/index.spec.tsx index cb1d0f2a55..25a8bd625e 100644 --- a/web/app/components/base/chat/chat/chat-input-area/__tests__/index.spec.tsx +++ b/web/app/components/base/chat/chat/chat-input-area/__tests__/index.spec.tsx @@ -82,8 +82,11 @@ vi.mock('@/app/components/base/voice-input', () => { } }) -vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => setTimeout(() => cb(Date.now()), 16)) -vi.stubGlobal('cancelAnimationFrame', (id: number) => clearTimeout(id)) +vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => { + cb(Date.now()) + return 0 +}) +vi.stubGlobal('cancelAnimationFrame', vi.fn()) vi.stubGlobal('devicePixelRatio', 1) // Mock Canvas diff --git a/web/vite.config.ts b/web/vite.config.ts index 39dff85dae..2d99a65074 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -82,6 +82,7 @@ export default defineConfig(({ mode }) => { // Vitest config test: { + detectAsyncLeaks: true, environment: 'jsdom', globals: true, setupFiles: ['./vitest.setup.ts'],