Testing
The template uses Vitest on both sides. Tests sit next to the code they cover. The goal is confidence in your features, not snapshots of framework behavior.
Backend
Backend tests live under apps/backend next to features and routes. Prefer integration-style tests that hit real
modules and the database when the test environment provides one.
Conventions from the repo rules:
- Throw typed errors; do not assert on swallowed
try/catchpaths that the error middleware would handle - Keep mutations and queries tested through the feature modules when practical
- Use the shared testing helpers under
apps/backend/src/testing/
Run:
pnpm --filter @hype-stack/backend testFrontend
Frontend tests use Testing Library and HyperFetch setMock on SDK requests. That keeps hooks and components real while
controlling the network boundary.
pnpm --filter @hype-stack/frontend testDo not mock @hyper-fetch/react, the router, or internal hooks unless there is no other way. Prefer setMock on
sdk.* requests and clean mocks in afterEach.
Playwright / E2E
Browser E2E coverage depends on what your project generated and which packs you installed. If Playwright is present in the workspace, treat auth, org onboarding, and billing checkout as the high-value paths. Pack and registry sandboxes also exercise combinations outside your app; that is for pack authors, not day-to-day app work.
What not to test
- Pure re-exports and config objects
- Framework behavior (Hono routing, React rendering with no assertions)
- Third-party dashboard UIs (Stripe Checkout, WorkOS hosted screens)
Related
Every purchase and sponsorship funds my 8+ years of work on open source given freely to the community. It keeps the lights on, funds new packs, and keeps the ecosystem alive. Even a small tier means a lot. Thank you!
