Skip to content

Coverage in CI and Sonar, plus quality badges - #3

Merged
dopbase merged 3 commits into
mainfrom
ci/coverage-and-badges
Nov 14, 2026
Merged

dopbase merged 3 commits into
mainfrom
ci/coverage-and-badges

Conversation

@thomijasir

Copy link
Copy Markdown
Contributor

What

  • npm run test:coverage measures src/ with the v8 provider and writes coverage/lcov.info.
  • CI runs the tests with coverage. The run fails below 90% statements, 85% branches, 90% functions or 90% lines. Today it's 92/87/91/94.
  • The Sonar workflow runs coverage before the scan, and sonar-project.properties reads the lcov report. Before this, every file was excluded from Sonar's coverage figures.
  • The README has CodeQL, Sonar quality gate and Sonar coverage badges.

Notes

  • CodeQL already runs through GitHub's default setup, so this PR adds no CodeQL workflow. An advanced workflow would conflict with it.
  • The coverage badge shows data once the Sonar scan runs on main after the merge.
  • No version bump, tag or release.

Add the v8 coverage provider and an `npm run test:coverage` script. It
covers src/ only and writes coverage/lcov.info for Sonar.

The run fails when coverage drops below 90% statements, 85% branches,
90% functions or 90% lines, a little under today's 92/87/91/94.
CI runs the tests with coverage, so a drop below the thresholds fails
the check.

The Sonar workflow runs the same step before the scan and passes the
lcov report on. Before this, every file was excluded from Sonar's
coverage figures. Now only src/ is measured, without type declarations,
build scripts and config files. A test failure in the Sonar job doesn't
stop the scan, since CI already reports it.
CodeQL links to the default code scanning setup. The quality gate and
coverage badges come from SonarQube Cloud.
@sonarqubecloud

Copy link
Copy Markdown

@dopbase dopbase left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

@dopbase
dopbase merged commit 8537f49 into main Nov 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants