style: align test scaffolding with canonical PSMTplt#9
Conversation
Apply the three style rules from PowerShellModuleTemplate#23 to the test files this repo inherited from the template: - Named parameters on multi-arg cmdlet calls (Split-Path, Join-Path, Test-Path, Get-Module, Get-Content, Select-String, Get-TextFilesList, Test-FileUnicode) - Quoted string literals where they were left bareword (one -ErrorAction Stop -> -ErrorAction 'Stop') - ValidateNotNull / ValidateNotNullOrEmpty validators on mandatory param entries in tests/MetaFixers.psm1 Tests/MetaFixers.psm1 was also missing the named -FileInfo parameter on the Test-FileUnicode call inside Get-UnicodeFilesList; aligned with canonical. Behavior is unchanged; this is the first-party-files compliance work PR #23 brought to the template, applied here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughTest files and helper module apply parameter validation attributes, standardize path derivation patterns using named parameters, and improve robustness of manifest and file discovery workflows across test setup phases. ChangesTest Infrastructure Hardening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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
This PR aligns the repository’s inherited PowerShell test scaffolding with the canonical PowerShellModuleTemplate style rules (named multi-arg cmdlet parameters, quoted string literals where required, and mandatory parameter validators), without changing test behavior.
Changes:
- Standardized multi-argument cmdlet calls to use named parameters across Pester tests (e.g.,
Split-Path,Join-Path,Test-Path,Get-Module,Get-Content,Select-String). - Added mandatory-parameter validation attributes in
tests/MetaFixers.psm1for key parameters. - Normalized a few PowerShell literal/parameter usages (e.g.,
-ErrorAction 'Stop',Get-Content -Path ...).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/Help.tests.ps1 |
Converts several cmdlet calls to named-parameter form for consistency with template style rules. |
tests/Manifest.tests.ps1 |
Applies named-parameter cleanup in both discovery and execution setup blocks; normalizes a couple of parameter/literal usages. |
tests/Meta.tests.ps1 |
Updates helper calls to use named parameters (Get-TextFilesList, Test-FileUnicode, Get-Content, Select-String). |
tests/MetaFixers.psm1 |
Adds validators to mandatory parameters and standardizes a helper invocation to named parameter form. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Applies the three style rules from PowerShellModuleTemplate#23 to the test files this repo inherited from the template:
tests/Help.tests.ps1Split-Path,Join-Path,Test-Path,Get-Module(3 call sites ofSplit-Path -Parent; 2 each ofJoin-PathandGet-Module; 1Test-Path).tests/Manifest.tests.ps1BeforeDiscovery, once inBeforeAll). Plus one bareword-ErrorAction Stop→-ErrorAction 'Stop', andGet-Content $changelogPath→Get-Content -Path $changelogPath.tests/Meta.tests.ps1Get-TextFilesList -Root,Test-FileUnicode -FileInfo,Get-Content -Path,Select-String -Pattern.tests/MetaFixers.psm1[ValidateNotNull()]on$FileInfoinConvertTo-UTF8andConvertTo-SpaceIndentation;[ValidateNotNullOrEmpty()]on$RootinGet-TextFilesListandGet-UnicodeFilesList. PlusTest-FileUnicode $_→Test-FileUnicode -FileInfo $_insideGet-UnicodeFilesList.Why
PR #23 brought the template's first-party test files into compliance with the three rules in
instructions/powershell.instructions.md(quoted string literals, named multi-arg cmdlet calls, mandatory-param validators). The scaffolds this repo inherited were carrying the pre-#23 shape; this PR closes the gap so the templated test layer matches canonical.Behavior is unchanged. Same Pester assertions run, just with hardened call sites.
Test plan
./build.ps1runs the same assertion count as beforeOut of scope
The 6 mandatory-string-param validators in
tests/ManifestHelpers.psm1shipped already in PR #8 (2026-05-11); theSplit-SemVerStringvalidator shipped earlier in PR #7. The remaining template-side drift (stale.PARAMETER "Must not be null"text onCompare-SemVerPrerelease, now-redundantIsNullOrWhiteSpaceguards onTest-VersionConstraint) is tracked in PowerShellModuleTemplate#30 and will propagate from the template source.🤖 Generated with Claude Code
Summary by CodeRabbit
Tests
Chores