Skip to content

Fix the PATH test for MSIX installed PowerShell - #28068

Merged
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
daxian-dbw:test-fix
Sep 25, 2026
Merged

Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
daxian-dbw:test-fix

Conversation

@daxian-dbw

Copy link
Copy Markdown
Member

PR Summary

Fix the PATH test for MSIX installed PowerShell, which uses the stable path to its execution alias instead of $PSHOME.

Copilot AI lite review requested due to automatic review settings September 23, 2026 17:29
@daxian-dbw
Dongbo Wang (daxian-dbw) requested a review from a team as a code owner September 23, 2026 17:29
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-Test Indicates that a PR should be marked as a test change in the Change Log label Sep 23, 2026

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.

Copilot review overview

🔵 Needs a closer look

MSIX path derivation is unreliable for prerelease package paths and SemanticVersion fields.

Review effort: Lite
Findings: None

What changed in this PR

Updates the PATH startup test for MSIX-installed PowerShell, which uses a stable execution-alias path.

Changes:

  • Detects MSIX installations.
  • Derives the expected stable alias path.
  • Updates PATH assertions.
File Description
test/​powershell/​Host/​ConsoleHost.Tests.ps1 Adjusts PATH expectations for MSIX-installed PowerShell.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

$path | Should -BeExactly ($PSHOME + [System.IO.Path]::PathSeparator)

$ExpectedPath = $PSHOME
if ($PSHOME.StartsWith("$env:ProgramFiles\WindowsApps\Microsoft.PowerShell")) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name is "pwsh starts even if PATH is not defined" - is this only we should test? If so, we can simply return and check any other value.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what you meant. This test is to validate if PowerShell can add exe path to PATH when the PATH env var doesn't exist.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of this test only says that pwsh is running successfully in the absence of a PATH. If you want to check exactly the PATH value that pwsh creates, then name the test accordingly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I updated the test name.

Comment thread test/powershell/Host/ConsoleHost.Tests.ps1 Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.6.x-Done CL-Test Indicates that a PR should be marked as a test change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants