mirror of
https://mirror.skon.top/github.com/langgenius/dify.git
synced 2026-04-20 23:40:16 +08:00
test: enable async leak detection in vitest config
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -82,6 +82,7 @@ export default defineConfig(({ mode }) => {
|
||||
|
||||
// Vitest config
|
||||
test: {
|
||||
detectAsyncLeaks: true,
|
||||
environment: 'jsdom',
|
||||
globals: true,
|
||||
setupFiles: ['./vitest.setup.ts'],
|
||||
|
||||
Reference in New Issue
Block a user