File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -661,6 +661,21 @@ function Invoke-TestItem {
661661 $script :ScriptBlockSessionStateInternalProperty.SetValue ($sb , $SessionStateInternal )
662662 $sb
663663 )
664+ # Write start marker after name expansion so it shows the
665+ # fully expanded test name (fixes #2635).
666+ {
667+ if ($PesterPreference.Debug.ShowStartMarkers.Value ) {
668+ $level = $Test.Path.Count
669+ $margin = $ReportStrings.Margin * ($level )
670+ $out = " $ ( $Test.ExpandedName ) ..."
671+
672+ if ($PesterPreference.Debug.ShowNavigationMarkers.Value ) {
673+ $out += " , $ ( $Test.ScriptBlock.File ) :$ ( $Test.StartLine ) "
674+ }
675+
676+ Write-PesterHostMessage - ForegroundColor $ReportTheme.Information " $margin [|] $out "
677+ }
678+ }
664679 ) `
665680 - ScriptBlock $Test.ScriptBlock `
666681 - Teardown @ (
Original file line number Diff line number Diff line change @@ -613,18 +613,6 @@ function Get-WriteScreenPlugin ($Verbosity) {
613613 if ($_test.First ) {
614614 Write-BlockToScreen $_test.Block
615615 }
616-
617- if ($PesterPreference.Debug.ShowStartMarkers.Value ) {
618- $level = $_test.Path.Count
619- $margin = $ReportStrings.Margin * ($level )
620- $out = " $ ( $_test.ExpandedName ) ..."
621-
622- if ($PesterPreference.Debug.ShowNavigationMarkers.Value ) {
623- $out += " , $ ( $_test.ScriptBlock.File ) :$ ( $_test.StartLine ) "
624- }
625-
626- Write-PesterHostMessage - ForegroundColor $ReportTheme.Information " $margin [|] $out "
627- }
628616 }
629617 }
630618
Original file line number Diff line number Diff line change @@ -184,6 +184,37 @@ i -PassThru:$PassThru {
184184 $i3Start = $output | Select-String - Pattern ' \[\|\] i3\.\.\.$'
185185 @ ($i3Start ).Count | Verify- Equal 1
186186 }
187+
188+ t ' Start markers show expanded names for data-driven tests' {
189+ $sb = {
190+ $PesterPreference = [PesterConfiguration ]::Default
191+ $PesterPreference.Output.Verbosity = ' Detailed'
192+ $PesterPreference.Debug.ShowStartMarkers = $true
193+ $PesterPreference.Output.CIFormat = ' None'
194+ $PesterPreference.Output.RenderMode = ' ConsoleColor'
195+
196+ $container = New-PesterContainer - ScriptBlock {
197+ Describe ' d1' {
198+ It ' Iteration <_>' - ForEach @ (1 , 2 , 3 ) {
199+ 1 | Should - Be 1
200+ }
201+ }
202+ }
203+ Invoke-Pester - Container $container
204+ }
205+
206+ $output = Invoke-InNewProcess $sb
207+ # only print the relevant part of output
208+ $null , $run = $output -join " `n " -split ' Running tests.'
209+ $run | Write-Host
210+
211+ $i1Start = $output | Select-String - Pattern ' \[\|\] Iteration 1\.\.\.$'
212+ @ ($i1Start ).Count | Verify- Equal 1
213+ $i2Start = $output | Select-String - Pattern ' \[\|\] Iteration 2\.\.\.$'
214+ @ ($i2Start ).Count | Verify- Equal 1
215+ $i3Start = $output | Select-String - Pattern ' \[\|\] Iteration 3\.\.\.$'
216+ @ ($i3Start ).Count | Verify- Equal 1
217+ }
187218 }
188219
189220 b ' Output for container names' {
You can’t perform that action at this time.
0 commit comments