Skip to content

fix(tests): run the param-help check (populate vars in BeforeDiscovery)#13

Merged
tablackburn merged 1 commit into
mainfrom
fix/help-tests-discovery-phase
May 23, 2026
Merged

fix(tests): run the param-help check (populate vars in BeforeDiscovery)#13
tablackburn merged 1 commit into
mainfrom
fix/help-tests-discovery-phase

Conversation

@tablackburn
Copy link
Copy Markdown
Owner

Propagates PowerShellModuleTemplate#35 (canonical fix, merged).

The Help.tests.ps1 'help parameter help' Context used -Foreach $helpParameterNames with the variable set only in BeforeAll. Since Pester evaluates -Foreach at discovery, 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. Fix: populate $helpParameters/$helpParameterNames (and $commandName, used in the Context name) in BeforeDiscovery.

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

…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>
Copilot AI review requested due to automatic review settings May 23, 2026 00:03
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Warning

Review limit reached

@tablackburn, we couldn't start this review because you've used your available PR reviews for now.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f95d0e16-7fb8-44d7-a5d6-fd532920843f

📥 Commits

Reviewing files that changed from the base of the PR and between b3a45b2 and 34185ad.

📒 Files selected for processing (1)
  • tests/Help.tests.ps1
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/help-tests-discovery-phase

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 $helpParameterNames in BeforeDiscovery so nested -ForEach blocks 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.

@tablackburn tablackburn merged commit 81b9cf3 into main May 23, 2026
12 checks passed
@tablackburn tablackburn deleted the fix/help-tests-discovery-phase branch May 23, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants