Skip to content

Commit 08ae402

Browse files
authored
Merge branch 'main' into ci/harden-psgallery-check
2 parents 282de8a + 350bdea commit 08ae402

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/Help.tests.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,16 @@ BeforeAll {
111111
Describe "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

0 commit comments

Comments
 (0)