Problem
Coverage output is LCOV-only (src/coverage/report_lcov.sh:5), plus a self-contained HTML report. LCOV is what Codecov and Coveralls want; it is not what the CI platforms with built-in coverage UIs want:
- GitLab CI coverage visualisation in merge requests: Cobertura XML only.
- Azure DevOps
PublishCodeCoverageResults: Cobertura or JaCoCo.
- Jenkins Coverage plugin: Cobertura among others.
So a bashunit user on GitLab has full line and branch coverage data and no way to render it next to the diff.
The tracking engine already produces everything Cobertura needs — per-file line hits (src/coverage/lines.sh), branch data (src/coverage/branches.sh) and totals (src/coverage/stats.sh).
Proposal
--coverage-report-cobertura [file] Write Cobertura XML (default: coverage/cobertura.xml)
Emit a standard Cobertura document:
<coverage line-rate="0.87" branch-rate="0.71" lines-covered="…" lines-valid="…"
branches-covered="…" branches-valid="…" version="…" timestamp="…">
<sources><source>/abs/repo/root</source></sources>
<packages>
<package name="src.assert" line-rate="…" branch-rate="…">
<classes>
<class name="core.sh" filename="src/assert/core.sh" line-rate="…" branch-rate="…">
<methods>…</methods>
<lines><line number="12" hits="3" branch="false"/></lines>
</class>
</classes>
</package>
</packages>
</coverage>
filename must be repo-relative — GitLab resolves paths relative to the repository root and silently shows nothing when they are absolute.
Where to change
Acceptance criteria
Repo checklist (agent)
- TDD: RED → GREEN → REFACTOR. Write the failing test first.
- Bash 3.0+ only: no
printf -v, no += append, no declare -A, no [[ ]], no ${var,,}, no &>>, no ${arr[-1]}. Expanding a possibly-empty array under set -u needs ${arr[@]+"${arr[@]}"}.
- A new CLI flag must be wired in all of these or a parity test fails:
- Gates:
make sa, make lint, ./bashunit tests/, ./bashunit --parallel tests/. Never run shfmt -w.
- Docs: update
docs/command-line.md. Editing docs/assertions.md invalidates the bashunit doc acceptance snapshot — regenerate it.
- CHANGELOG.md: add one line under
## Unreleased.
- Fixtures under
tests/acceptance/fixtures/ must not end in *test.sh.
- One issue = one PR.
Problem
Coverage output is LCOV-only (
src/coverage/report_lcov.sh:5), plus a self-contained HTML report. LCOV is what Codecov and Coveralls want; it is not what the CI platforms with built-in coverage UIs want:PublishCodeCoverageResults: Cobertura or JaCoCo.So a bashunit user on GitLab has full line and branch coverage data and no way to render it next to the diff.
The tracking engine already produces everything Cobertura needs — per-file line hits (
src/coverage/lines.sh), branch data (src/coverage/branches.sh) and totals (src/coverage/stats.sh).Proposal
Emit a standard Cobertura document:
filenamemust be repo-relative — GitLab resolves paths relative to the repository root and silently shows nothing when they are absolute.Where to change
src/coverage/report_cobertura.sh, registered insrc/coverage/index.sh(a file not reachable from anindex.shwill be missing from the standalone build — cf. Watch subcommand fails with "bashunit::watch::run: command not found" (src/watch.sh missing from release build) #735).src/coverage/config.sh,src/main/test.sh,src/config/env.sh,.env.example,--help, completions.Acceptance criteria
--coverage --coverage-report-coberturawrites a well-formed documentcoverage-04.dtd) — assert withxmllintwhen available, skip cleanly when notfilenameattributes are repo-relativeline-rateandbranch-ratematch the percentages the console report printsbranch="true"andcondition-coverage="50% (1/2)"where the engine has it--coverage-report(LCOV) and--coverage-report-htmlin one runtests/unit/coverage/Repo checklist (agent)
printf -v, no+=append, nodeclare -A, no[[ ]], no${var,,}, no&>>, no${arr[-1]}. Expanding a possibly-empty array underset -uneeds${arr[@]+"${arr[@]}"}.src/main/test.sh(report-style flags needexport -n, seesrc/main/test.sh:188-196for why)bashunit::main::validate_config_or_exit(src/main/validate.sh:60) — unvalidated input used to run the wrong thing and exit 0 (Unknown options are silently ignored: a typo'd flag runs a different suite and exits 0 #871, --jobs with a non-integer value hangs on Bash 3.x and is silently ignored on Bash 4.3+ #873)src/config/env.shand a documented line in.env.example--helptext in the same block it belongs tocompletions/bashunit.bashandcompletions/_bashunit(anti-drift test feat(cli): bash and zsh completion scripts with an anti-drift test #778 fails otherwise)make sa,make lint,./bashunit tests/,./bashunit --parallel tests/. Never runshfmt -w.docs/command-line.md. Editingdocs/assertions.mdinvalidates thebashunit docacceptance snapshot — regenerate it.## Unreleased.tests/acceptance/fixtures/must not end in*test.sh.