Testing Strategy

Framework

Vitest is the sole test runner across the entire monorepo — frontend and Cloud Functions. Not Jasmine, not Jest, not Karma.

npm test                    # All tests (frontend + functions)
npm run test:frontend       # Frontend tests only (Vitest + Angular)
npm run test:functions      # Cloud Functions tests only (Vitest + DI mocks)

Approach

Cloud Functions

Cloud Functions use a factory pattern for dependency injection. Each handler receives its dependencies (Firestore, Auth, etc.) as constructor arguments, making it straightforward to substitute mocks in tests without reaching for module-level patching.

Frontend

Angular components and services are tested with Vitest and Angular’s testing utilities. The test setup leverages Angular’s TestBed with Vitest’s faster execution model.

Build-Time Validation

The content pipeline validates frontmatter schemas at build time — catching content errors (missing titles, invalid dates, malformed tags) before deployment rather than at runtime.

Type Safety as Verification

TypeScript strict mode (strict: true, no implicit any) catches entire categories of bugs at compile time. The project treats the type system as a first line of defense, not an afterthought.