GeezerVison is showing github.com — Add targeted test file option to build script by bergmeister · Pull Request #2259 · PowerShell/PSScriptAnalyzer
Conversation
Add an optional -TestPath parameter to build.ps1 -Test so contributors can run a single Pester test file without launching the full suite. The path is resolved as a literal file path; omitting it preserves the existing full-suite behavior. Validated with the targeted UseConsistentIndentation test file and the full test suite.
This help with local development so that one doesn't need to keep spawning test shells and more importantly help Copilot verify changes more easily.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Regression tests are needed for Test-ScriptAnalyzer’s new path-selection behavior, including single-file selection, apostrophe preservation, invalid-path rejection, and the default four-directory selection.
1 open issue
What changed in this PR
Adds optional -TestPath support to build.ps1 -Test, allowing contributors to run a single Pester test file while preserving the default full-suite behavior.
Changes:
- Exposes
TestPath in the test parameter set and forwards it to the build module.
- Resolves the supplied path literally, rejects directories, and escapes apostrophes when constructing the Pester invocation.
| File |
Description |
build.psm1 |
Selects and validates the requested test file, retaining the existing suite directories by default. |
build.ps1 |
Adds the optional TestPath parameter and passes it to Test-ScriptAnalyzer. |
Review effort: Balanced
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Test paths on custom PowerShell drives pass validation but fail in child processes because Resolve-Path.Path preserves drive names unavailable there; use .ProviderPath instead.
2 open issues
Review effort: Balanced
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues are recorded for the optional -TestPath support.
1 open issue
1 resolved since last review
Review effort: Balanced
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
🟢 Approval recommended
No active review issues are recorded for the optional -TestPath support.
1 open issue
1 resolved since last review
Review effort: Balanced
Copilot fix
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
🟢 Approval recommended
No active review issues are recorded for the optional -TestPath support.
...
The requested regression coverage is already present in 6a4cc32 (single file, apostrophes, missing path, directory rejection, and the four default suite directories). I ran BuildModule.tests.ps1; all 20 tests pass.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The path escaping leaves typographic apostrophes unchanged, causing generated PowerShell script blocks to fail parsing for valid paths containing those characters.
1 open issue
1 resolved since last review
Review effort: Balanced
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
At least 1 approving review is required to merge this pull request.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|