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'],