Summary
Add Jest unit testing infrastructure to the frontend codebase to enable fast, isolated unit tests alongside the existing TestCafe E2E tests.
Motivation
The frontend currently relies on TestCafe for E2E testing, which is excellent for integration tests but can be slow and complex for testing individual utility functions and business logic. Adding Jest provides:
- Fast feedback loop - Unit tests run in milliseconds, not minutes
- Isolated testing - Test pure functions and utilities without browser overhead
- Better coverage - Easier to test edge cases and error conditions
- CI integration - Quick unit test checks on every PR
Changes
Jest Configuration
- Add Jest with
ts-jest preset for TypeScript support
- Configure module path aliases (
common/, components/, project/)
- Set up coverage collection for
common/ and web/ directories
- Support for both
__tests__/ directory pattern and *.test.ts files
CI/CD Integration
- Add new GitHub Actions workflow (
frontend-pull-request.yml)
- Runs unit tests automatically on PRs that modify frontend code
- Uses Node.js version from
.nvmrc for consistency
Initial Test Coverage
- Add comprehensive unit tests for
featureFilterParams utility (245 lines)
- Tests for
buildUrlParams, buildApiFilterParams, getFiltersFromParams, hasActiveFilters
- Covers archived feature filtering logic
Dependencies Added
jest - Test runner
ts-jest - TypeScript preprocessor for Jest
@types/jest - TypeScript definitions
Testing
cd frontend
npm run test:unit
Related
Note: This branch also includes fixes for versioned environment toggle functionality and E2E test improvements, which may be split into separate PRs if needed.
Summary
Add Jest unit testing infrastructure to the frontend codebase to enable fast, isolated unit tests alongside the existing TestCafe E2E tests.
Motivation
The frontend currently relies on TestCafe for E2E testing, which is excellent for integration tests but can be slow and complex for testing individual utility functions and business logic. Adding Jest provides:
Changes
Jest Configuration
ts-jestpreset for TypeScript supportcommon/,components/,project/)common/andweb/directories__tests__/directory pattern and*.test.tsfilesCI/CD Integration
frontend-pull-request.yml).nvmrcfor consistencyInitial Test Coverage
featureFilterParamsutility (245 lines)buildUrlParams,buildApiFilterParams,getFiltersFromParams,hasActiveFiltersDependencies Added
jest- Test runnerts-jest- TypeScript preprocessor for Jest@types/jest- TypeScript definitionsTesting
cd frontend npm run test:unitRelated
Note: This branch also includes fixes for versioned environment toggle functionality and E2E test improvements, which may be split into separate PRs if needed.