ci: add frontend test execution, reporting, and coverage in workflow (#8815)

* chore: add jest-junit dependency for improved test reporting

- Updated package.json and package-lock.json to include jest-junit version 16.0.0, enhancing test reporting capabilities in the project.

* chore: enhance Jest configuration for improved test coverage and CI reporting

- Added coverage collection settings, including coverage thresholds and report formats.
- Configured CI-specific options for Jest, including the use of jest-junit for test reporting and adjusted worker settings for better performance in CI environments.

* chore: update frontend test command for CI mode to ensure proper environment variable usage

- Modified the test command in the Makefile to set CI=true for accurate test execution in CI environments.

* chore: enhance frontend CI workflow with test reporting and coverage uploads

- Replaced the frontend dependency installation step with a command to run unit tests in CI mode.
- Added steps to publish test results using junit report and to comment on pull requests with coverage summaries.
- Implemented artifact upload for coverage reports to improve visibility and tracking of test coverage over time.

* chore: add frontend dependency installation step to CI workflow

- Introduced a step to install frontend dependencies using npm ci in the GitHub Actions workflow.
- This enhancement ensures that all necessary packages are available before running frontend unit tests, improving the reliability of the CI process.

* chore: update junit report action version in CI workflow

- Upgraded the junit report action from v5 to v5.5.1 in the GitHub Actions workflow to leverage the latest features and improvements for test result reporting.

* chore: add Jest unit test workflow for frontend

- Introduced a new GitHub Actions workflow to run Jest unit tests for the frontend.
- The workflow includes steps for checking out the repository, setting up the Node.js environment, running tests, publishing test results, adding coverage comments on pull requests, and uploading coverage reports.
- This enhancement improves the CI process by ensuring comprehensive testing and reporting for frontend components.

* chore: integrate Jest unit tests into CI workflow

- Added a new job to the CI workflow to run frontend unit tests using Jest.
- Updated the changes filter to include Jest test files, ensuring they are recognized during the CI process.
- This enhancement improves the testing coverage and reliability of the frontend components.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-07-01 17:38:10 -03:00 • committed by GitHub
commit 6bf60ece71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 169 additions and 6 deletions

View file

@ -104,7 +104,7 @@ test_frontend_verbose: frontend_deps_check ## run frontend tests with verbose ou
# Run frontend tests in CI mode (no watch, with coverage)
test_frontend_ci: frontend_deps_check ## run frontend tests in CI mode
@echo "Running frontend tests in CI mode..."
@cd $(FRONTEND_DIR) && npx jest --ci --coverage --watchAll=false
@cd $(FRONTEND_DIR) && CI=true npx jest --ci --coverage --watchAll=false
# Clean test cache and run tests
test_frontend_clean: frontend_deps_check ## clean test cache and run tests
@ -186,7 +186,7 @@ help_frontend: ## show frontend help
@echo ""
@echo "Code Quality:"
@echo " format_frontend - Format frontend code"
@echo ""
@echo ""
@echo "Testing:"
@echo " tests_frontend - Run frontend Playwright e2e tests"
@echo " test_frontend - Run frontend Jest unit tests"
@ -203,4 +203,4 @@ help_frontend: ## show frontend help
@echo " test_frontend_file path - Run tests for specific file"
@echo " test_frontend_pattern pattern - Run tests matching pattern"
@echo " test_frontend_snapshots - Update Jest snapshots"
@echo " test_frontend_config - Show Jest configuration"
@echo " test_frontend_config - Show Jest configuration"