-
Notifications
You must be signed in to change notification settings - Fork 466
Open
Description
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-jestpreset for TypeScript support - Configure module path aliases (
common/,components/,project/) - Set up coverage collection for
common/andweb/directories - Support for both
__tests__/directory pattern and*.test.tsfiles
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
.nvmrcfor consistency
Initial Test Coverage
- Add comprehensive unit tests for
featureFilterParamsutility (245 lines)- Tests for
buildUrlParams,buildApiFilterParams,getFiltersFromParams,hasActiveFilters - Covers archived feature filtering logic
- Tests for
Dependencies Added
jest- Test runnerts-jest- TypeScript preprocessor for Jest@types/jest- TypeScript definitions
Testing
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.
Metadata
Metadata
Assignees
Labels
No labels