Skip to content

Commit 841002a

Browse files
tablackburnclaude
andcommitted
fix: emit Pester NUnit results to tests/out
The Pester task computed $testResultsXml but never passed it to Invoke-Pester, so no results file was ever written, and the path used OutputDir (Output/) rather than the tests/out path the CI workflow uploads. Switch to a Pester 5 configuration object that writes tests/out/testResults.xml so the shared workflow's upload/publish steps have results to consume. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3141e72 commit 841002a

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

psakeFile.ps1

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,23 @@ task Analyze -depends Build {
3333
task Pester -depends Build {
3434
Remove-Module $settings.ProjectName -ErrorAction SilentlyContinue -Verbose:$false
3535

36-
$testResultsXml = [IO.Path]::Combine($settings.OutputDir, 'testResults.xml')
37-
$testResults = Invoke-Pester -Path $settings.Tests -Output Detailed -PassThru
36+
# Write the NUnit results to tests/out/testResults.xml so the shared CI workflow can
37+
# upload and publish them (its artifact step looks for ./tests/out/testResults.xml).
38+
$testResultsDir = [IO.Path]::Combine($settings.ProjectRoot, 'tests', 'out')
39+
if (-not (Test-Path -Path $testResultsDir)) {
40+
New-Item -Path $testResultsDir -ItemType Directory -Force > $null
41+
}
42+
$testResultsXml = [IO.Path]::Combine($testResultsDir, 'testResults.xml')
43+
44+
$pesterConfiguration = New-PesterConfiguration
45+
$pesterConfiguration.Run.Path = $settings.Tests.FullName
46+
$pesterConfiguration.Run.PassThru = $true
47+
$pesterConfiguration.Output.Verbosity = 'Detailed'
48+
$pesterConfiguration.TestResult.Enabled = $true
49+
$pesterConfiguration.TestResult.OutputPath = $testResultsXml
50+
$pesterConfiguration.TestResult.OutputFormat = 'NUnitXml'
51+
52+
$testResults = Invoke-Pester -Configuration $pesterConfiguration
3853

3954
if ($testResults.FailedCount -gt 0) {
4055
$testResults | Format-List

0 commit comments

Comments
 (0)