Skip to content

Commit c5bd5b2

Browse files
author
Jacek
committed
fix(test): Mock @formkit/auto-animate/react in vitest setup
The __mocks__ directory in src/elements/ was not detected by Vitest for node_module mocks, so auto-animate ran in tests and leaked timers that fired after jsdom teardown, causing requestAnimationFrame errors.
1 parent cdc7d44 commit c5bd5b2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎packages/clerk-js/vitest.setup.mts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ if (typeof window !== 'undefined') {
262262
window.getComputedStyle = patchedGetComputedStyle;
263263
}
264264

265+
// Mock @formkit/auto-animate to prevent timers leaking after test teardown.
266+
// The __mocks__ directory in src/elements/ is not detected by Vitest for
267+
// node_module mocks, so we need an explicit vi.mock here.
268+
vi.mock('@formkit/auto-animate/react', () => ({
269+
useAutoAnimate: () => [null],
270+
}));
271+
265272
// Mock browser-tabs-lock to prevent window access errors in tests
266273
vi.mock('browser-tabs-lock', () => {
267274
return {

0 commit comments

Comments
 (0)