File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,11 +111,16 @@ BeforeAll {
111111Describe " Test help for <_.Name>" - ForEach $commands {
112112
113113 BeforeDiscovery {
114- # Get command help, parameters, and links
114+ # Get command help, parameters, and links. These are duplicated in BeforeAll
115+ # below; they must also exist here because the nested Context blocks use them in
116+ # -ForEach, which Pester evaluates during discovery (before BeforeAll runs).
115117 $command = $_
118+ $commandName = $command.Name
116119 $commandHelp = Get-Help - Name $command.Name - ErrorAction ' SilentlyContinue'
117120 $commandParameters = global:FilterOutCommonParameters - Parameters $command.ParameterSets.Parameters
118121 $commandParameterNames = $commandParameters.Name
122+ $helpParameters = global:FilterOutCommonParameters - Parameters $commandHelp.Parameters.Parameter
123+ $helpParameterNames = $helpParameters.Name
119124 $helpLinks = $commandHelp.relatedLinks.navigationLink.uri | Where-Object { $_ -match ' ^https?://' }
120125 }
121126
You can’t perform that action at this time.
0 commit comments