Mirrors apps/portal's Vitest setup so the SPA can take frontend unit + component tests. Required prerequisite for WS-6 sessie 3b's admin UI work — apps/portal had 113+ tests, apps/app had zero, and launching WS-6's organizer UI uncovered while the portal SPA is well-tested would be asymmetric quality. Setup: - vitest, happy-dom, @vue/test-utils, @testing-library/vue installed - vitest.config.ts mirrors portal config: trimmed auto-imports (no pinia/vue-router/vue-i18n/@vueuse/math) so tests run fast in happy-dom without loading the full Vuexy bundle - AutoImport's dts:false prevents the trimmed test-only set from clobbering the dev-server's full auto-imports.d.ts (apps/app's auto-import surface is bigger than the portal's) - tests/setup.ts mocks vue-router by default; tests that exercise the real router can override per-suite - Sample sanity test confirms the harness works end-to-end Adds `pnpm test` and `pnpm test:watch` scripts to package.json. Refs: BACKLOG TECH-APP-VITEST, WS-6 sessie 3b prerequisite Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9 lines
327 B
TypeScript
9 lines
327 B
TypeScript
import { vi } from 'vitest'
|
|
|
|
// Default vue-router mock — individual tests can override with their own mock.
|
|
// Page-level tests that exercise the actual router should not import this.
|
|
vi.mock('vue-router', () => ({
|
|
useRoute: () => ({ params: {}, query: {} }),
|
|
useRouter: () => ({ push: vi.fn(), replace: vi.fn() }),
|
|
}))
|