quicknotes/vitest-setup-client.ts

18 lines
461 B
TypeScript

import '@testing-library/jest-dom/vitest';
import { vi } from 'vitest';
// required for svelte5 + jsdom as jsdom does not support matchMedia
Object.defineProperty(window, 'matchMedia', {
writable: true,
enumerable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn()
}))
});
// add more mocks here if you need them