Fix test perf by stopping ongoing write-progress (#17749)

This commit is contained in:
Frode Flaten
2022-07-25 11:19:10 -07:00
committed by GitHub
parent 8eb37cc44d
commit f1595c4b31
@@ -384,18 +384,18 @@ Describe 'ActionPreference.Break tests' -Tag 'CI' {
Write-Debug -Message 'This is a debug message'
Write-Information -MessageData 'This is an information message'
Write-Progress -Activity 'This shows progress'
Write-Progress -Activity 'This shows progress' -Completed
}
Test-Break -WarningAction Break -InformationAction Break *>$null
$WarningPreference = $VerbosePreference = $DebugPreference = $InformationPreference = $ProgressPreference = [System.Management.Automation.ActionPreference]::Break
Test-Break *>$null
}
$results = @(Test-Debugger -Scriptblock $testScript)
}
It 'Should show 7 debugger commands were invoked' {
It 'Should show 8 debugger commands were invoked' {
# When no debugger commands are provided, 'c' is invoked every time a breakpoint is hit
$results.Count | Should -Be 7
$results.Count | Should -Be 8
}
It 'Write-Warning should trigger a breakpoint from -WarningAction Break' {