Skip to content

Commit b064143

Browse files
committed
Fix container name display when running non-file types (fixes #2639).
Use a helper that formats the container name correctly for all container types, notably also for ScriptBlocks.
1 parent 81d46ce commit b064143

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/csharp/Pester/ContainerInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public static ContainerInfo Create()
1111
return new ContainerInfo();
1212
}
1313

14+
public string Name { get => ToStringConverter.ContainerItemToString(Type, Item); }
1415
private string _type = Constants.File;
1516
public string Type
1617
{

src/functions/Output.ps1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,8 @@ function Get-WriteScreenPlugin ($Verbosity) {
560560
$p.ContainerRunStart = {
561561
param ($Context)
562562

563-
if ("file" -eq $Context.Block.BlockContainer.Type) {
564-
# write two spaces to separate each file
565-
Write-PesterHostMessage -ForegroundColor $ReportTheme.Container "`nRunning tests from '$($Context.Block.BlockContainer.Item)'"
566-
}
563+
# write two spaces to separate each container
564+
Write-PesterHostMessage -ForegroundColor $ReportTheme.Container "`nRunning tests from '$($Context.Block.BlockContainer.Name)'"
567565
}
568566
}
569567

0 commit comments

Comments
 (0)