chore: vitest 4 for web, cli, and e2e (#26668)

This commit is contained in:
Daniel Dietzler
2026-03-04 15:19:13 +01:00
committed by GitHub
parent 5989c9b4aa
commit 3c476b1987
16 changed files with 399 additions and 223 deletions
+13 -9
View File
@@ -3,19 +3,23 @@ import { init } from 'svelte-i18n';
beforeAll(async () => {
await init({ fallbackLocale: 'dev' });
Element.prototype.animate = vi.fn().mockImplementation(() => ({ cancel: () => {}, finished: Promise.resolve() }));
Element.prototype.animate = vi.fn().mockImplementation(function () {
return { cancel: () => {}, finished: Promise.resolve() };
});
});
Object.defineProperty(globalThis, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
value: vi.fn().mockImplementation(function (query) {
return {
matches: false,
media: query,
onchange: null,
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
};
}),
});
vi.mock('$env/dynamic/public', () => {