Pester icon indicating copy to clipboard operation
Pester copied to clipboard

ShowStartMarkers is missing data driven replacements

Open davidmatson opened this issue 7 months ago • 1 comments
trafficstars

Checklist

What is the issue?

I wanted to add a new PTest for this case, but I can't find the right implementation to make the test pass.

        t 'Test names are evaluated after data driven replacements when when ShowStartMarkers is enabled' {
            $sb = {
                $PesterPreference = [PesterConfiguration]::Default
                $PesterPreference.Output.Verbosity = 'Detailed'
                $PesterPreference.Debug.ShowStartMarkers = $true
                $PesterPreference.Output.CIFormat = 'None'
                $PesterPreference.Output.RenderMode = 'ConsoleColor'

                $container = New-PesterContainer -ScriptBlock {
                    Describe 'd1' {
                        It 'Iteration <_>' -ForEach (@(1..3)) {
                            1 | Should -Be 1
                        }
                    }
                }
                Invoke-Pester -Container $container
            }

            $output = Invoke-InNewProcess $sb
            # only print the relevant part of output
            $null, $run = $output -join "`n" -split 'Running tests.'
            $run | Write-Host

            $i1Start = $output | Select-String -Pattern '\[\|\] Iteration 1\.\.\.$'
            @($i1Start).Count | Verify-Equal 1
            $i1Start = $output | Select-String -Pattern '\[\|\] Iteration 2\.\.\.$'
            @($i2Start).Count | Verify-Equal 1
            $i1Start = $output | Select-String -Pattern '\[\|\] Iteration 3\.\.\.$'
            @($i3Start).Count | Verify-Equal 1
        }

I think that currently there is no Plugin step after the expansion is done, and fixing this bug would require creating a new Plugin step, or something like that, but I may be mistaken. @nohwnd @fflaten - thoughts?

Expected Behavior

Test name includes expansions

Steps To Reproduce

see snippet above

Describe your environment

No response

Possible Solution?

No response

davidmatson avatar Apr 08 '25 19:04 davidmatson