Skip to content

📖 [Docs]: Reference + proof for valid #Requires -Modules version syntax#23

Open
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
mainfrom
docs/requires-modules-reference
Open

📖 [Docs]: Reference + proof for valid #Requires -Modules version syntax#23
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
mainfrom
docs/requires-modules-reference

Conversation

@MariusStorhaug

Copy link
Copy Markdown
Member

Adds an authoritative reference for valid #Requires -Modules version specifications, so contributors — and PR-review bots — can see exactly which forms are valid, and prove it. This is prompted by a Copilot review that incorrectly flagged MaximumVersion = '6.*' as invalid; the reference settles it with a runnable test.

New: #Requires -Modules version-syntax reference

Coding-Standards/PowerShell/Requires-Modules.md documents each version-specification form — any / minimum / major-lock / ceiling-only / exact / +GUID — as a table with when to use each, and explains why MaximumVersion accepts the N.* wildcard (it is a string on ModuleSpecification, unlike the [System.Version] floor/exact keys), so no 6.999.999 sentinel is needed.

New: executable proof

tests/Requires-Modules.Tests.ps1 proves every row against the installed Pester (independent of the exact 6.x): the major lock resolves, the wildcard ceiling genuinely excludes a higher major, exact-but-missing does not resolve, and a wrong GUID blocks an otherwise-matching module while omitting the GUID still resolves. Validated locally — 8/8 pass on Pester 6.0.0.

Invoke-Pester -Path ./tests/Requires-Modules.Tests.ps1

Technical Details

  • New page src/docs/Coding-Standards/PowerShell/Requires-Modules.md; registered in the PowerShell index.md.
  • New tests/Requires-Modules.Tests.ps1 (self-contained; writes one-line #Requires scripts and runs them in a child PowerShell to observe real resolution).
  • Cross-links Security → Supply chain, Scripts, GitHub Actions, and the Dependency Updates capability.

@MariusStorhaug Marius Storhaug (MariusStorhaug) added the documentation Improvements or additions to documentation label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant