Skip to content

Add targeted test file option to build script - #2259

Open
Christoph Bergmeister (bergmeister) wants to merge 3 commits into
mainfrom
copilot/build-test-path
Open

Christoph Bergmeister (bergmeister) wants to merge 3 commits into
mainfrom
copilot/build-test-path

Conversation

@bergmeister

@bergmeister Christoph Bergmeister (bergmeister) commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 18:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread build.psm1 Resolved
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread build.psm1 Resolved
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

@bergmeister

Copy link
Copy Markdown
Collaborator Author

🟢 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

Copilot AI commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

🟢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread build.psm1 Resolved
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.

3 participants