File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff 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 ()
Original file line number Diff line number Diff 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+ $null , $run = $output -join " `n " -split ' Running tests.'
247+ $run | Write-Host
248+
249+ $run | Verify- Like ' *[-]*<ScriptBlock>* failed with:*'
250+ }
251+ }
252+
225253 b ' Write-PesterHostMessage' {
226254 t ' Ansi output includes colors when set and always reset' {
227255 $sb = {
You can’t perform that action at this time.
0 commit comments