Skip to content

Commit 088fa99

Browse files
author
Friedrich Weinmann
committed
fixing test output
1 parent 20b7d0b commit 088fa99

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

templates/PSFProject/PSMDTemplate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $null = New-Item -Path "$PSScriptRoot\..\.." -Name TestResults -ItemType Directo
3535
'@
3636
}
3737
pesterconfig = {
38-
'[PesterConfiguration]::Default.TestResult.Enabled = $true'
38+
'$config.TestResult.Enabled = $true'
3939
}
4040
}
4141
}

templates/PSFTests/pester.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ $totalFailed = 0
3232
$totalRun = 0
3333

3434
$testresults = @()
35+
$config = [PesterConfiguration]::Default
3536
þ!pesterconfig!þ
3637

3738
#region Run General Tests
@@ -44,8 +45,11 @@ if ($TestGeneral)
4445
if ($file.Name -like $Exclude) { continue }
4546

4647
Write-PSFMessage -Level Significant -Message " Executing <c='em'>$($file.Name)</c>"
47-
[PesterConfiguration]::Default.TestResult.OutputPath = Join-Path "$PSScriptRoot\..\..\TestResults" "TEST-$($file.BaseName).xml"
48-
$results = Invoke-Pester -Path $file.FullName -Output $Output -PassThru
48+
$config.TestResult.OutputPath = Join-Path "$PSScriptRoot\..\..\TestResults" "TEST-$($file.BaseName).xml"
49+
$config.Run.Path = $file.FullName
50+
$config.Run.PassThru = $true
51+
$config.Output.Verbosity = $Output
52+
$results = Invoke-Pester -Configuration $config
4953
foreach ($result in $results)
5054
{
5155
$totalRun += $result.TotalCount
@@ -75,8 +79,11 @@ if ($TestFunctions)
7579
if ($file.Name -like $Exclude) { continue }
7680

7781
Write-PSFMessage -Level Significant -Message " Executing $($file.Name)"
78-
[PesterConfiguration]::Default.TestResult.OutputPath = Join-Path "$PSScriptRoot\..\..\TestResults" "TEST-$($file.BaseName).xml"
79-
$results = Invoke-Pester -Path $file.FullName -Output $Output -PassThru
82+
$config.TestResult.OutputPath = Join-Path "$PSScriptRoot\..\..\TestResults" "TEST-$($file.BaseName).xml"
83+
$config.Run.Path = $file.FullName
84+
$config.Run.PassThru = $true
85+
$config.Output.Verbosity = $Output
86+
$results = Invoke-Pester -Configuration $config
8087
foreach ($result in $results)
8188
{
8289
$totalRun += $result.TotalCount

0 commit comments

Comments
 (0)