Context
PR #247 introduces `V0Error` / `isV0Error` as the canonical way to assert v0-thrown errors in user tests. There's no docs page today that covers testing patterns for v0 consumers — testing knowledge is scattered across `.claude/rules/testing.md` (which is contributor-private) and individual test files.
Ask
Add a dedicated testing guide page to `apps/docs`, probably under a new "Guides" section or a "Recipes / Testing" subsection.
Suggested scope
- Setup — recommended deps (Vitest, happy-dom or jsdom), config snippets.
- Mocking Vue DI — `vi.mock('vue', () => ({ provide, inject }))` pattern + `hasInjectionContext` extension.
- Mocking plugins — `global.plugins: [createThemePlugin(), ...]` in @vue/test-utils.
- Fake timers — `vi.useFakeTimers()` + `vi.advanceTimersByTime` for `useTimer`, `useDelay`, `usePopover`, etc.
- SSR-only tests — splitting `*.ssr.test.ts` with hoisted `vi.mock('#v0/constants/globals', ...)`.
- Asserting throws + cause shape — `isV0Error(err, 'V0_CONTEXT_MISSING')` narrowing pattern, full list of codes from `V0ErrorDetails`.
- Asserting warnings — `vi.spyOn(console, 'warn')` capture-and-assert pattern (PHILOSOPHY §9.2 says never silently swallow).
- Locale-safe assertions — `toBeDefined()` not exact text (PHILOSOPHY §5.5).
Reference material
- `packages/0/.claude/rules/testing.md` — current contributor-facing rules; a lot of this content can be lifted to a user-facing page.
- Example tests across `packages/0/src/composables/**/*.test.ts`.
Notes
Context
PR #247 introduces `V0Error` / `isV0Error` as the canonical way to assert v0-thrown errors in user tests. There's no docs page today that covers testing patterns for v0 consumers — testing knowledge is scattered across `.claude/rules/testing.md` (which is contributor-private) and individual test files.
Ask
Add a dedicated testing guide page to `apps/docs`, probably under a new "Guides" section or a "Recipes / Testing" subsection.
Suggested scope
Reference material
Notes