test: fix pre-existing failures — localStorage polyfill + prefs shape drift

- jsdom 29's localStorage methods are undefined under this vitest config, so
  every frontend test calling localStorage.clear()/setItem() threw. Add a
  shared in-memory Web Storage polyfill via setupFiles (no-op when a working
  Storage exists / in node env). Fixes quick-reply, push, projects-panel (135 tests).
- Update desktop prefs test: defaultPrefs gained remoteHosts/selectedHostId
  (remote-host mTLS work); sync EXPECTED_DEFAULTS and the round-trip fixture.

Full suite now green: 1473 passed (was 142 failing).
This commit is contained in:
Yaojia Wang
2026-07-07 21:09:49 +02:00
parent fc3b849a08
commit 57725f7ef2
3 changed files with 74 additions and 0 deletions

View File

@@ -4,6 +4,10 @@ export default defineConfig({
test: {
include: ['test/**/*.test.ts'],
environment: 'node',
// jsdom 29's localStorage methods are undefined under this config; a shared
// in-memory Web Storage polyfill fixes the frontend (@vitest-environment
// jsdom) tests that call localStorage.clear()/setItem(). No-op in node env.
setupFiles: ['test/setup/local-storage.ts'],
// Scaffold has no tests yet; don't fail the script until modules add theirs.
passWithNoTests: true,
// Coverage target is the global 80% rule; enforced with `--coverage`.