test: vitest foundation with browser mode

Two projects in one root config: 'unit' (happy-dom) for stores, hooks,
and utils, and 'browser' (real Chromium via the playwright provider)
for component tests — no jsdom polyfills for EventSource, AudioContext,
or canvas. Harness pieces: createMockPlatform (spy-able Platform with
an updater emit handle), renderWithProviders (fresh QueryClient with
polling disabled + PlatformProvider), MSW worker with baseline health
handler, and a store-reset teardown covering all eight zustand stores.
Seed tests cover uiStore theme, serverStore invalidation, and an
AboutPage render in Chromium.

Requires node >= 20 (.node-version added); run with bun run test.
This commit is contained in:
Jamie Pine
2026-08-08 15:22:28 -07:00
parent 6174cd64d6
commit fddcd61f4d
17 changed files with 999 additions and 6 deletions
+11 -1
View File
@@ -27,13 +27,23 @@
"format:check": "biome format .",
"check": "biome check .",
"check:fix": "biome check --write .",
"test": "vitest run",
"test:watch": "vitest",
"ci": "bun run typecheck && bun run build:web"
},
"devDependencies": {
"@biomejs/biome": "2.3.12",
"@types/node": "^20.0.0",
"@vitejs/plugin-react": "^6.0.5",
"@vitest/browser": "^4.1.10",
"@vitest/browser-playwright": "^4.1.10",
"happy-dom": "^20.11.2",
"msw": "^2.15.0",
"playwright": "^1.62.1",
"tailwindcss": "^4.1.18",
"typescript": "^5.6.0"
"typescript": "^5.6.0",
"vitest": "^4.1.10",
"vitest-browser-react": "^2.2.0"
},
"engines": {
"bun": ">=1.0.0"