Skip to content

Testing Strategy for Ariane Monorepo

  • ✅ Basic security autofix testing (scripts/test-security-autofix.js)
  • ✅ Lighthouse configuration (.lighthouserc.js)
  • ✅ ESLint + Prettier for code quality
  • ❌ No unit/integration tests for components
  • ❌ No API route testing
  • ❌ No authentication flow testing
  • ❌ No E2E testing

Why: Fast, modern, works great with TypeScript and Astro Coverage: Components, utilities, API routes, middleware

Why: Excellent for testing full authentication flows, cross-browser Coverage: User journeys, WebAuthn, Cloudflare Access integration

3. MSW (Mock Service Worker) - API Mocking

Section titled “3. MSW (Mock Service Worker) - API Mocking”

Why: Reliable API mocking for tests and development Coverage: External APIs (Sanity, Zitadel, GitHub OAuth)

Why: Best practices for testing user interactions Coverage: Astro components, React components (Studio)

  1. Add Vitest configuration
  2. Create test utilities and helpers
  3. Set up MSW for API mocking
  4. Add basic component tests
  1. Test API routes (/api/auth/*, /api/oauth/*)
  2. Test middleware authentication logic
  3. Test Sanity CMS integration
  4. Test WASM fallback mechanisms
  1. Set up Playwright
  2. Test complete authentication flows
  3. Test WebAuthn registration/authentication
  4. Test Cloudflare Access integration
  1. Lighthouse CI integration
  2. Security vulnerability testing
  3. Performance regression testing
  4. Bundle size monitoring
Terminal window
# Run all tests
npm run test
# Run tests with coverage
npm run test:coverage
# Run E2E tests
npm run test:e2e
# Run performance tests
npm run test:performance
# Run security tests
npm run test:security
tests/
├── unit/ # Unit tests
│ ├── lib/ # Library utilities
│ ├── components/ # Component tests
│ └── middleware/ # Middleware tests
├── integration/ # Integration tests
│ ├── api/ # API route tests
│ ├── auth/ # Authentication tests
│ └── sanity/ # CMS integration tests
├── e2e/ # End-to-end tests
│ ├── auth-flow.spec.ts
│ ├── webauthn.spec.ts
│ └── studio.spec.ts
├── fixtures/ # Test data and fixtures
├── helpers/ # Test utilities
└── setup/ # Test environment setup