chore: Enhance frontend CI workflow for improved test coverage reporting
Some checks failed
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 41s
Docker Build and Push / build-and-push (push) Failing after 41s
LabFusion CI/CD Pipeline / service-adapters (push) Successful in 57s
Integration Tests / integration-tests (push) Failing after 40s
Integration Tests / performance-tests (push) Has been skipped
LabFusion CI/CD Pipeline / api-docs (push) Successful in 1m44s
Frontend (React) / test (20) (push) Failing after 1m29s
Frontend (React) / build (push) Has been skipped
Frontend (React) / lighthouse (push) Has been skipped
LabFusion CI/CD Pipeline / frontend (push) Successful in 4m1s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped

### Summary of Changes
- Updated the test command in the CI workflow to use `npx vitest` for running tests with coverage.
- Added a verification step to check for the presence of coverage files (`lcov.info` and `clover.xml`).
- Configured Vitest to output JUnit test results and detailed coverage reports in the specified directory.

### Expected Results
- Improved visibility and reliability of test coverage metrics, facilitating better quality assurance processes.
This commit is contained in:
GSRN
2025-09-16 23:04:43 +02:00
parent 5a9d00725f
commit 58a785b0cb
2 changed files with 38 additions and 3 deletions

View File

@@ -70,8 +70,23 @@ jobs:
- name: Run tests
run: |
npm test -- --run --coverage --reporter=verbose
npm run test:coverage
npx vitest run --coverage --reporter=verbose
- name: Verify coverage files
run: |
echo "Checking coverage files..."
ls -la coverage/
echo "Required coverage files:"
if [ -f "coverage/lcov.info" ]; then
echo "✓ lcov.info found"
else
echo "✗ lcov.info missing"
fi
if [ -f "coverage/clover.xml" ]; then
echo "✓ clover.xml found"
else
echo "✗ clover.xml missing"
fi
- name: Send results to SonarQube
run: |
@@ -84,7 +99,11 @@ jobs:
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
-Dsonar.projectKey=labfusion-frontend \
-Dsonar.projectName=LabFusion Frontend
-Dsonar.projectName=LabFusion Frontend \
-Dsonar.sources=src \
-Dsonar.tests=src \
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info \
-Dsonar.coverageReportPaths=coverage/clover.xml
- name: Test results summary
if: always()