Skip to content

Commit f613764

Browse files
committed
vitest fixes
1 parent 1574bb7 commit f613764

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

vitest.setup.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ Object.defineProperty(window, 'matchMedia', {
1919
});
2020

2121
// Mock ResizeObserver
22-
(globalThis as any).ResizeObserver = vi.fn().mockImplementation(() => ({
23-
observe: vi.fn(),
24-
unobserve: vi.fn(),
25-
disconnect: vi.fn(),
26-
}));
22+
(globalThis as any).ResizeObserver = vi.fn().mockImplementation(function () {
23+
return {
24+
observe: vi.fn(),
25+
unobserve: vi.fn(),
26+
disconnect: vi.fn(),
27+
};
28+
});
2729

28-
// Mock IntersectionObserver
29-
(globalThis as any).IntersectionObserver = vi.fn().mockImplementation(() => ({
30-
observe: vi.fn(),
31-
unobserve: vi.fn(),
32-
disconnect: vi.fn(),
33-
}));
30+
// Mock IntersectionObserver
31+
(globalThis as any).IntersectionObserver = vi.fn().mockImplementation(function () {
32+
return {
33+
observe: vi.fn(),
34+
unobserve: vi.fn(),
35+
disconnect: vi.fn(),
36+
};
37+
});
3438

3539
// Mock requestAnimationFrame
3640
(globalThis as any).requestAnimationFrame = vi.fn().mockImplementation((cb: Function) => {

0 commit comments

Comments
 (0)