From 10995c1209e1c3cbe1fc5ea80337c1e6027eda3b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Jul 2026 18:56:07 +0000 Subject: [PATCH 1/2] chore: Track code coverage of the built module in the Pester task Enable Pester code coverage over the built module output, write a JaCoCo report to tests/out/coverage.xml, and print a one-line summary in the task output so the number is visible in every CI log. Tracking only - no threshold gate: the number understates real coverage because tests that exercise code in child processes (the build.tests.ps1 child builds and the Test-PSBuildPester subprocess matrix) are invisible to session instrumentation. Publishing the report from CI is #139. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_011semwa5HU1BUKKL4RoWjKa --- psakeFile.ps1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/psakeFile.ps1 b/psakeFile.ps1 index 390b69c..66ec128 100644 --- a/psakeFile.ps1 +++ b/psakeFile.ps1 @@ -49,8 +49,25 @@ task Pester -depends Build { $pesterConfiguration.TestResult.OutputPath = $testResultsXml $pesterConfiguration.TestResult.OutputFormat = 'NUnitXml' + # Track (never gate on) code coverage of the built module. The number understates real + # coverage: tests that exercise code in child processes (the build.tests.ps1 child builds + # and the Test-PSBuildPester subprocess matrix) are invisible to session instrumentation. + # Publishing the JaCoCo file from CI is psake/PowerShellBuild#139. + $pesterConfiguration.CodeCoverage.Enabled = $true + $pesterConfiguration.CodeCoverage.Path = $settings.ModuleOutDir + $pesterConfiguration.CodeCoverage.OutputPath = [IO.Path]::Combine($testResultsDir, 'coverage.xml') + $pesterConfiguration.CodeCoverage.OutputFormat = 'JaCoCo' + $testResults = Invoke-Pester -Configuration $pesterConfiguration + if ($testResults.CodeCoverage) { + $coverageMessage = 'Code coverage: {0:p1} of analyzed commands executed ({1} of {2})' -f ( + $testResults.CodeCoverage.CoveragePercent / 100), + $testResults.CodeCoverage.CommandsExecutedCount, + $testResults.CodeCoverage.CommandsAnalyzedCount + Write-Host $coverageMessage -ForegroundColor Cyan + } + # Result aggregates every failure category (failed tests, blocks, containers), # matching the gate in Test-PSBuildPester. if ($testResults.Result -eq 'Failed') { From 195c66b1cd84150c840a10416a60b7115dd674ca Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Jul 2026 19:01:06 +0000 Subject: [PATCH 2/2] style: Group all format-operator arguments in one array Address review feedback on #140: the argument list relied on comma binding tighter than -f, with a grouping paren that closed after the first argument. The output was correct, but the code read as if only one argument were grouped. Group all three arguments explicitly. Verified: coverage summary line prints identically (391 tests passed). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_011semwa5HU1BUKKL4RoWjKa --- psakeFile.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/psakeFile.ps1 b/psakeFile.ps1 index 66ec128..593b7eb 100644 --- a/psakeFile.ps1 +++ b/psakeFile.ps1 @@ -61,10 +61,11 @@ task Pester -depends Build { $testResults = Invoke-Pester -Configuration $pesterConfiguration if ($testResults.CodeCoverage) { - $coverageMessage = 'Code coverage: {0:p1} of analyzed commands executed ({1} of {2})' -f ( - $testResults.CodeCoverage.CoveragePercent / 100), - $testResults.CodeCoverage.CommandsExecutedCount, + $coverageMessage = 'Code coverage: {0:p1} of analyzed commands executed ({1} of {2})' -f @( + ($testResults.CodeCoverage.CoveragePercent / 100) + $testResults.CodeCoverage.CommandsExecutedCount $testResults.CodeCoverage.CommandsAnalyzedCount + ) Write-Host $coverageMessage -ForegroundColor Cyan }