File tree 2 files changed +29
-1
lines changed
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -384,7 +384,7 @@ i -PassThru:$PassThru {
384
384
$ps.HadErrors | Verify- False
385
385
$res.PassedCount | Verify- Equal 1
386
386
# 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 }
388
388
}
389
389
finally {
390
390
$ps.Dispose ()
Original file line number Diff line number Diff line change @@ -222,6 +222,34 @@ i -PassThru:$PassThru {
222
222
}
223
223
}
224
224
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
+
225
253
b ' Write-PesterHostMessage' {
226
254
t ' Ansi output includes colors when set and always reset' {
227
255
$sb = {
You can’t perform that action at this time.
0 commit comments