Skip to content

Commit c7ea458

Browse files
tablackburnclaude
andcommitted
fix(tests): set $commandName in BeforeDiscovery for the now-discovered Context name
The 'Test <_> help parameter help for <commandName>' Context name expands <commandName> at discovery, but $commandName was only set in BeforeAll. Now that the prior fix makes this Context actually get discovered, populate $commandName in BeforeDiscovery too so the generated test names render correctly. Flagged by Copilot on #35. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ccd076e commit c7ea458

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tests/Help.tests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Describe "Test help for <_.Name>" -ForEach $commands {
115115
# below; they must also exist here because the nested Context blocks use them in
116116
# -ForEach, which Pester evaluates during discovery (before BeforeAll runs).
117117
$command = $_
118+
$commandName = $command.Name
118119
$commandHelp = Get-Help -Name $command.Name -ErrorAction 'SilentlyContinue'
119120
$commandParameters = global:FilterOutCommonParameters -Parameters $command.ParameterSets.Parameters
120121
$commandParameterNames = $commandParameters.Name

0 commit comments

Comments
 (0)