Commit 350bdea
fix(tests): populate help-parameter vars in BeforeDiscovery so the param-help check runs (#35)
* 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>
* 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>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 090de78 commit 350bdea
1 file changed
Lines changed: 6 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 | | |
| 118 | + | |
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
| 122 | + | |
| 123 | + | |
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
| |||
0 commit comments