Problem
A mistyped --coverage-paths (or one matching only comments, or no shell files)
produces:
Total: 0/0 (0%)
Coverage 0% is below minimum 80%
The number is arithmetic, not a measurement — nothing was found to measure. But
the message sends the reader to their tests when the cause is the paths. In CI
this is a gate failing for a reason nobody can act on from the output.
Fix
Split the two cases:
Coverage gate failed: no executable lines were tracked
Check --coverage-paths (BASHUNIT_COVERAGE_PATHS): it matched no shell file with executable code.
Genuinely uncovered code keeps Coverage 0% is below minimum 80% — that one is
accurate and is what the flag exists to report.
It still fails: a misconfigured run quietly satisfying an 80% gate is worse
than either message.
Note
The gate could not see the executable total because get_percentage echoes, so
every caller wraps it in $( ) and a return slot set inside dies with that
subshell. The totals are now computed by a slot-setting helper the gate calls
directly; get_percentage stays the echoing wrapper.
Problem
A mistyped
--coverage-paths(or one matching only comments, or no shell files)produces:
The number is arithmetic, not a measurement — nothing was found to measure. But
the message sends the reader to their tests when the cause is the paths. In CI
this is a gate failing for a reason nobody can act on from the output.
Fix
Split the two cases:
Genuinely uncovered code keeps
Coverage 0% is below minimum 80%— that one isaccurate and is what the flag exists to report.
It still fails: a misconfigured run quietly satisfying an 80% gate is worse
than either message.
Note
The gate could not see the executable total because
get_percentageechoes, soevery caller wraps it in
$( )and a return slot set inside dies with thatsubshell. The totals are now computed by a slot-setting helper the gate calls
directly;
get_percentagestays the echoing wrapper.