You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CodeCoverageThreshold still gates every JaCoCo report counter (CLASS/METHOD/INSTRUCTION/LINE), so a realistic module cannot scope a line-coverage gate #231
Follow-up to the resolved #138 (truncation fixed on main by #165). The remaining half of the threshold-gate problem is still present at HEAD (main @ 3ea9e82): the gate compares EVERY report-level JaCoCo counter against the single CodeCoverageThreshold value.
$ccReport=$testCoverage.report.counter.ForEach({ ... }) # line 125
...
$ccReport.ForEach({ # line 140'{0}: [{1}]: {2:p}'-f$LocalizedData.Type,$_.name,$_.percentif ($_.percent-lt$CodeCoverageThreshold) { # line 142$ccFailMsgs+= ($LocalizedData.CodeCoverageLessThanThreshold-f ...)
}
})
$testCoverage.report.counter is the report-level counter list from the JaCoCo XML: INSTRUCTION, LINE, METHOD, CLASS. These counters measure different things and diverge widely on real modules, so one scalar threshold cannot express a sane gate. Example: LINE = 60% but CLASS = 37.5% (3 of 8 source files exercised) - a 0.45 threshold should pass on lines, yet the build still fails on CLASS, with no way to say "gate LINE only". In practice consumers either set the threshold to 0 or turn coverage off, which defeats the feature.
Suggested fix (either is sufficient):
Add a parameter such as [string[]]$CodeCoverageGateCounters = @('LINE') selecting which counter types enforce the threshold, keeping the other counters printed for information.
Or gate only LINE and demote the other counters to display-only.
Pester 6.1.0's own CodeCoverage.CoveragePercentTarget is display-only (colors the console line; exit code derives solely from failed tests), so delegating this gate to Pester would not enforce anything today.
Activity