test: load the OS command handler once before the launch tests, so a busy machine doesn't time the first one out

This commit is contained in:
Linus Rath
2026-11-04 13:43:27 +01:00
parent 09335c76c5
commit 5bb9887961
+7 -1
View File
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import type { BulwarkDesktopBridge, DesktopOsCommand } from '../types';
import type { NotificationActionRequest, NotificationActionStatus } from '@/lib/pwa-notify/page-actions';
@@ -44,6 +44,12 @@ async function run(command: DesktopOsCommand) {
const text = (value: string) => new TextEncoder().encode(value);
// The handler pulls in much of the app the first time; load it once here, with room to spare,
// so the first test isn't the one that times out on a busy machine.
beforeAll(async () => {
await import('../os-commands');
}, 60_000);
beforeEach(async () => {
vi.clearAllMocks();
authenticated = true;