Fix the PATH test for MSIX installed PowerShell - #28068
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
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")) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Gotcha. I updated the test name.
PR Summary
Fix the PATH test for MSIX installed PowerShell, which uses the stable path to its execution alias instead of
$PSHOME.