ci(sonarqube): populate the "Unit Tests" measure via a test-execution report #87
Reference in New Issue
Block a user
No description provided.
Delete Branch "ci/sonar-test-execution-report"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & why
Follow-up to #86. On the SonarQube dashboard, Coverage populates (from the LCOV reports) but the "Unit Tests" tile shows
-. Those are two independent inputs: the Unit Tests measure is fed by a test-execution report viasonar.testExecutionReportPaths, in SonarQube's Generic Test Execution XML format — which none of Node's built-in reporters (lcov,junit,spec) produce. So the count was never reported.This adds that missing report:
scripts/sonar-test-reporter.mjs— a dependency-free customnode:testreporter that emits the Generic Test Execution XML: repo-root-relative<file path>entries (matchingsonar.tests), integer-milliseconddurations, XML-escaped names, suites filtered out so the count matches the runner..gitea/workflows/sonarqube.yml— runs it as a third reporter on both the server and client coverage steps (alongsidespec→stdout andlcov→file, all in onenode --testinvocation).sonar-project.properties— declaressonar.testExecutionReportPathsfor both suites.How it was tested
Ran the exact CI command locally (all three reporters in one invocation):
<file path>entries come out repo-root-relative (server/test/…,client/test/…), matchingsonar.tests.node --testexits 0.After this lands on
main(the SonarQube workflow runs on push tomain), the next analysis will show 423 unit tests instead of-.Checklist
AI-assisted contributions (required)
Claude Code (Opus 4.8). I have reviewed and understand every change, and take responsibility for it. AI-authored commits are marked with aCo-Authored-Bytrailer.License
🤖 Generated with Claude Code