Skip to content

A coverage run that tracked nothing reports it as 0% coverage #1171

Description

@Chemaclass

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions