File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -569,7 +569,7 @@ function Get-WriteScreenPlugin ($Verbosity) {
569
569
param ($Context )
570
570
571
571
if ($Context.Result.ErrorRecord.Count -gt 0 ) {
572
- $errorHeader = " [-] $ ( $Context.Result.Item ) failed with:"
572
+ $errorHeader = " [-] $ ( $Context.Result.Name ) failed with:"
573
573
574
574
$formatErrorParams = @ {
575
575
Err = $Context.Result.ErrorRecord
@@ -590,13 +590,13 @@ function Get-WriteScreenPlugin ($Verbosity) {
590
590
$humanTime = " $ ( Get-HumanTime ($Context.Result.Duration )) ($ ( Get-HumanTime $Context.Result.UserDuration ) |$ ( Get-HumanTime $Context.Result.FrameworkDuration ) )"
591
591
592
592
if ($Context.Result.Passed ) {
593
- Write-PesterHostMessage - ForegroundColor $ReportTheme.Pass " [+] $ ( $Context.Result.Item ) " - NoNewLine
593
+ Write-PesterHostMessage - ForegroundColor $ReportTheme.Pass " [+] $ ( $Context.Result.Name ) " - NoNewLine
594
594
Write-PesterHostMessage - ForegroundColor $ReportTheme.PassTime " $humanTime "
595
595
}
596
596
597
597
# this won't work skipping the whole file when all it's tests are skipped is not a feature yet in 5.0.0
598
598
if ($Context.Result.Skip ) {
599
- Write-PesterHostMessage - ForegroundColor $ReportTheme.Skipped " [!] $ ( $Context.Result.Item ) " - NoNewLine
599
+ Write-PesterHostMessage - ForegroundColor $ReportTheme.Skipped " [!] $ ( $Context.Result.Name ) " - NoNewLine
600
600
Write-PesterHostMessage - ForegroundColor $ReportTheme.SkippedTime " $humanTime "
601
601
}
602
602
}
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 @@ -250,6 +250,34 @@ i -PassThru:$PassThru {
250
250
}
251
251
}
252
252
253
+ b ' Output for container names' {
254
+ t ' Script Block container names are output when BeforeAll fails' {
255
+ $sb = {
256
+ $PesterPreference = [PesterConfiguration ]::Default
257
+ $PesterPreference.Output.Verbosity = ' Detailed'
258
+ $PesterPreference.Output.RenderMode = ' ConsoleColor'
259
+
260
+ $container = New-PesterContainer - ScriptBlock {
261
+ BeforeAll {
262
+ throw ' bad error'
263
+ }
264
+ Describe ' d1' {
265
+ It ' i1' {
266
+ 1 | Should - Be 1
267
+ }
268
+ }
269
+ }
270
+ Invoke-Pester - Container $container
271
+ }
272
+
273
+ $output = Invoke-InNewProcess $sb
274
+ $null , $run = $output -join " `n " -split ' Running tests.'
275
+ $run | Write-Host
276
+
277
+ $run | Verify- Like ' *[-]*<ScriptBlock>* failed with:*'
278
+ }
279
+ }
280
+
253
281
b ' Write-PesterHostMessage' {
254
282
t ' Ansi output includes colors when set and always reset' {
255
283
$sb = {
You can’t perform that action at this time.
0 commit comments