Testing Strategy
Status: Draft (stub) — aligns testing layers with monorepo architecture.
- Fast feedback (unit + type tests) under 30s incremental.
- Confidence in brand theming and feature gating.
- Avoid duplication across web/mobile surfaces.
Layers
Section titled “Layers”- Type-level (tsc —noEmit) — enforced via verify gate.
- Unit tests (Vitest for Vite web apps, Jest for React Native until parity).
- Integration smoke (serve + minimal render) — later via Playwright / Detox.
- Contract tests (registry schema + feature compatibility) — future.
- Visual regression (brand theming snapshots) — future opt-in.
Tooling Choices
Section titled “Tooling Choices”| Surface | Framework | Rationale |
|---|---|---|
| Web (Vite) | Vitest | Native Vite integration, fast transforms |
| Mobile (Expo) | Jest | RN ecosystem alignment |
| Cross-lib | Vitest | Simplicity + shared config |
Conventions
Section titled “Conventions”- Co-locate
*.test.ts(x)with source. - Use
data-testidfor integration view selectors. - Avoid deep renderer mocks; prefer lightweight real component trees.
- Stable snapshots only for theming/structure (not dynamic data).
Brand-Specific Testing
Section titled “Brand-Specific Testing”- Generate matrix test helper that iterates over brand keys (post type generation script) for theme assertions.
- Skip heavy tests for experimental brands via tag filtering.
Coverage Philosophy
Section titled “Coverage Philosophy”- Focus on critical path (registry loader, theming adapter, navigation). Avoid chasing a raw percentage.
Roadmap
Section titled “Roadmap”- Add base vitest config for one web app
- Add jest config template improvements (scaffold script)
- Introduce brand key iteration utility
- Add example contract test for registry invariants
Future Enhancements
Section titled “Future Enhancements”- Visual regression via Storybook + Chromatic or Loki
- Playwright smoke: build + serve + brand root URL assertions
- Detox minimal mobile navigation test