Commit ccd076e
fix(tests): populate help-parameter vars in BeforeDiscovery so the param-help check runs
The 'help parameter help' Context in Help.tests.ps1 uses -Foreach $helpParameterNames,
but $helpParameterNames was assigned only in BeforeAll (run phase). Pester evaluates
-Foreach during DISCOVERY, so the collection was $null then and the Context expanded
to ZERO tests -- the 'no stale/extra parameters documented in help' check has been a
silent no-op in this template and every module scaffolded from it.
Fix: also populate $helpParameters/$helpParameterNames in BeforeDiscovery (mirroring
$commandParameters, which already works in that same block), so the Context generates
one test per documented parameter.
Verified locally with Pester 5.7.1: a -Foreach collection set in BeforeDiscovery
generates tests; the same collection set only in BeforeAll generates zero.
Flagged by Copilot on the ReScenePS test-scaffolding-alignment PR (#18).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 090de78 commit ccd076e
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
0 commit comments