Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions psakeFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,26 @@
$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') {
Expand All @@ -71,7 +89,7 @@

# Commented out rather than removed to allow easy use in future
# Generate Invoke-Build tasks from Psake tasks
# $psakePath = [IO.Path]::Combine($settings.ModuleOutDir, 'psakefile.ps1')

Check warning on line 92 in psakeFile.ps1

View workflow job for this annotation

GitHub Actions / CI / Run Linters

Unknown word (psakefile) Suggestions: (pagefile, planefile, pageFile, Pagefile, planeFile)
# $ibPath = [IO.Path]::Combine($settings.ModuleOutDir, 'IB.tasks.ps1')
# & .\Build\Convert-PSAke.ps1 $psakePath | Out-File -Encoding UTF8 $ibPath
}
Expand Down
Loading