Skip to content

Commit fd1b9f6

Browse files
committed
Update test given new output.
1 parent 750f454 commit fd1b9f6

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

tst/Pester.RSpec.InNewProcess.ts.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ i -PassThru:$PassThru {
384384
$ps.HadErrors | Verify-False
385385
$res.PassedCount | Verify-Equal 1
386386
# Information-stream introduced in PSv5 for Write-Host output
387-
if ($PSVersionTable.PSVersion.Major -ge 5) { $ps.Streams.Information -match 'Describe' | Verify-NotNull }
387+
if ($PSVersionTable.PSVersion.Major -ge 5) { $ps.Streams.Information -match '<ScriptBlock>' | Verify-NotNull }
388388
}
389389
finally {
390390
$ps.Dispose()

tst/Pester.RSpec.Output.ts.ps1

+28
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,34 @@ i -PassThru:$PassThru {
222222
}
223223
}
224224

225+
b 'Output for container names' {
226+
t 'Script Block container names are output when BeforeAll fails' {
227+
$sb = {
228+
$PesterPreference = [PesterConfiguration]::Default
229+
$PesterPreference.Output.Verbosity = 'Detailed'
230+
$PesterPreference.Output.RenderMode = 'ConsoleColor'
231+
232+
$container = New-PesterContainer -ScriptBlock {
233+
BeforeAll {
234+
throw 'bad error'
235+
}
236+
Describe 'd1' {
237+
It 'i1' {
238+
1 | Should -Be 1
239+
}
240+
}
241+
}
242+
Invoke-Pester -Container $container
243+
}
244+
245+
$output = Invoke-InNewProcess $sb
246+
$output | Write-Host
247+
248+
$describe1 = $output | Select-String -Pattern '\[-\].*\<ScriptBlock\>.* failed with:$'
249+
@($describe1).Count | Verify-Equal 1
250+
}
251+
}
252+
225253
b 'Write-PesterHostMessage' {
226254
t 'Ansi output includes colors when set and always reset' {
227255
$sb = {

0 commit comments

Comments
 (0)