fix(tests): run the param-help check (populate vars in BeforeDiscovery)#13
Conversation
…very so the param-help check runs Propagates PowerShellModuleTemplate#35. The 'help parameter help' Context used -Foreach $helpParameterNames with the variable set 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 was a silent no-op. Populate $helpParameters/$helpParameterNames (and $commandName, used in the Context name) in BeforeDiscovery so the check actually runs. Verified via the template fix (#35) with Pester 5.7.1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 59 minutes and 55 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes a Pester discovery-time issue in Help.tests.ps1 where -ForEach inputs were populated only in BeforeAll, causing the “help parameter help” context to expand to zero tests (silent no-op). This aligns the repo’s tests with the canonical fix from PowerShellModuleTemplate#35.
Changes:
- Populate
$commandName,$helpParameters, and$helpParameterNamesinBeforeDiscoveryso nested-ForEachblocks expand correctly at discovery time. - Add clarifying comments explaining why discovery-time initialization is required.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Propagates PowerShellModuleTemplate#35 (canonical fix, merged).
The
Help.tests.ps1'help parameter help' Context used-Foreach $helpParameterNameswith the variable set only inBeforeAll. Since Pester evaluates-Foreachat discovery, the collection was$nullthen and the Context expanded to zero tests — the 'no stale/extra parameters documented in help' check was a silent no-op. Fix: populate$helpParameters/$helpParameterNames(and$commandName, used in the Context name) inBeforeDiscovery.Verified on the template (#35) with Pester 5.7.1 (3 tests vs 0). Identical block across the fleet, applied per-repo. No source/manifest change.
🤖 Generated with Claude Code