Skip to content

Commit

Permalink
adding missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Aug 11, 2024
1 parent a5ad35e commit a722bd2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

// adding this for the "TypeError: window.matchMedia is not a function" error
// see https://github.com/vitest-dev/vitest/issues/821

import { vi } from 'vitest';


Object.defineProperty(window, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});

class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}

window.ResizeObserver = ResizeObserver;

0 comments on commit a722bd2

Please sign in to comment.