Skip to content

Fix container name in ScriptBlock BeforeAll failures (fixes #2636). #2637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/functions/Output.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ function Get-WriteScreenPlugin ($Verbosity) {
param ($Context)

if ($Context.Result.ErrorRecord.Count -gt 0) {
$errorHeader = "[-] $($Context.Result.Item) failed with:"
$errorHeader = "[-] $($Context.Result.Name) failed with:"

$formatErrorParams = @{
Err = $Context.Result.ErrorRecord
Expand All @@ -592,13 +592,13 @@ function Get-WriteScreenPlugin ($Verbosity) {
$humanTime = "$(Get-HumanTime ($Context.Result.Duration)) ($(Get-HumanTime $Context.Result.UserDuration)|$(Get-HumanTime $Context.Result.FrameworkDuration))"

if ($Context.Result.Passed) {
Write-PesterHostMessage -ForegroundColor $ReportTheme.Pass "[+] $($Context.Result.Item)" -NoNewLine
Write-PesterHostMessage -ForegroundColor $ReportTheme.Pass "[+] $($Context.Result.Name)" -NoNewLine
Write-PesterHostMessage -ForegroundColor $ReportTheme.PassTime " $humanTime"
}

# this won't work skipping the whole file when all it's tests are skipped is not a feature yet in 5.0.0
if ($Context.Result.Skip) {
Write-PesterHostMessage -ForegroundColor $ReportTheme.Skipped "[!] $($Context.Result.Item)" -NoNewLine
Write-PesterHostMessage -ForegroundColor $ReportTheme.Skipped "[!] $($Context.Result.Name)" -NoNewLine
Write-PesterHostMessage -ForegroundColor $ReportTheme.SkippedTime " $humanTime"
}
}
Expand Down
2 changes: 1 addition & 1 deletion tst/Pester.RSpec.InNewProcess.ts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ i -PassThru:$PassThru {
$ps.HadErrors | Verify-False
$res.PassedCount | Verify-Equal 1
# Information-stream introduced in PSv5 for Write-Host output
if ($PSVersionTable.PSVersion.Major -ge 5) { $ps.Streams.Information -match 'Describe' | Verify-NotNull }
if ($PSVersionTable.PSVersion.Major -ge 5) { $ps.Streams.Information -match '<ScriptBlock>' | Verify-NotNull }
}
finally {
$ps.Dispose()
Expand Down