Testing Stack
Unit Tests
Vitest - Fast unit testing for utilities and business logic
- Tests in
__tests__/ - Run with
npm run test - Coverage reports included
E2E Tests
Cypress - Browser automation for critical user flows
- Tests in
cypress/e2e/ - Run with
npm run test:e2e - Dedicated test users for isolation
Test Coverage
What We Test
Unit Tests (__tests__/):
- Business logic (billing calculations, time utilities)
- Data transformations
- Helper functions
- Type utilities
cypress/e2e/):
- Authentication flows
- Critical user journeys (create task, approve quote)
- Client portal functionality
- Role-based access control
- UI styling/layout
- Third-party libraries
- Database migrations
- Simple CRUD operations
Running Tests
Unit Tests
E2E Tests
Unit Test Examples
Testing Utilities
Testing Date Utilities
E2E Test Examples
Authentication Flow
Test Configuration
Vitest Config
Cypress Config
CI/CD Integration
Tests run automatically on every pull request:Best Practices
Test Business Logic, Not Implementation
Test Business Logic, Not Implementation
Focus on behavior, not internal details:
Keep Tests Fast
Keep Tests Fast
Unit tests should run in milliseconds:
- No database calls in unit tests
- Mock external dependencies
- Use in-memory data
Use Descriptive Test Names
Use Descriptive Test Names
Test Edge Cases
Test Edge Cases
Don’t just test the happy path:
Debugging Tests
Vitest
Cypress
Coverage Reports
- Statements: 60%
- Branches: 50%
- Functions: 60%
- Lines: 60%
Related Documentation
Unit Tests
Writing unit tests with Vitest
E2E Tests
Writing E2E tests with Cypress
CI/CD
Automated testing in CI