Repository navigation
Add targeted test file option to build script - #2259
Christoph Bergmeister (bergmeister) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟡 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
TestPathin 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
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Copilot fix |
... The requested regression coverage is already present in |
There was a problem hiding this comment.
🟡 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


Add an optional
-TestPathparameter tobuild.ps1 -Testso 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 targetedUseConsistentIndentationtest 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.