feat(coverage): --coverage-report-cobertura for GitLab, Azure and Jenkins - #1052
Merged
Conversation
…kins LCOV feeds Codecov and Coveralls; the CI platforms with built-in coverage UIs want Cobertura XML: GitLab MR visualisation, Azure PublishCodeCoverageResults and the Jenkins Coverage plugin. Files group into packages by directory, every executable line carries its hit count, branch decision lines get branch="true" with a condition-coverage="P% (t/n)" derived from the engine's per-arm data, and rates come from the same integer percentage the console prints so the two cannot disagree. filename attributes stay repo-relative because GitLab silently renders nothing for absolute paths. Zero-hit files still appear. Validated against the vendored coverage-04.dtd in the unit tests. The path is checked up-front with a creatable-path rule: missing ancestors are fine (the writer mkdir -p's them, like LCOV), an unwritable first existing ancestor fails fast (#875). Closes #1017
The creatable-path rule accepted any writable first existing ancestor, so under root -- which is how the Bash 3.0 jobs run inside their container -- '/nonexistent-root-dir/report.xml' was genuinely creatable and the guard correctly did nothing, failing the test that asserted it would refuse. Require that ancestor to be a directory: a regular file in the path prefix makes mkdir -p impossible for every user, root included, while root passes a bare -w test on it. The acceptance test blocks with a regular file instead of relying on permissions, which also sidesteps Git Bash's faked permission bits on Windows.
The settings-parity contract added in #1063 requires every registered BASHUNIT_* setting to have a configuration.md section.
Chemaclass
force-pushed
the
feat/1017-cobertura-coverage
branch
from
August 11, 2026 18:39
8677863 to
c54cece
Compare
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 Background
Related #1017
Coverage output was LCOV-only (plus HTML), which serves Codecov and Coveralls but not the CI platforms with built-in coverage UIs — GitLab MR visualisation, Azure
PublishCodeCoverageResultsand the Jenkins Coverage plugin all want Cobertura XML.💡 Changes
--coverage-report-cobertura [file](defaultcoverage/cobertura.xml) reusing the existing line, branch and stats engines; packages group files by directory, branch lines carrycondition-coverage="P% (t/n)", rates derive from the same integer percentage the console printsfilenameattributes are repo-relative (GitLab silently shows nothing for absolute paths); zero-hit files still appear; coexists with LCOV and HTML in one runcoverage-04.dtdviaxmllint(skipped cleanly when absent)mkdir -ptheir own directories