Skip to content

Commit

Permalink
[Windows] Add WIX binaries folder to the PATH (#9582)
Browse files Browse the repository at this point in the history
* [Windows] Add WIX binaries folder to the PATH

* Add Update-Environment, small prettifying

* Move tests from script to Pester

* Fix Wix tests to use Join-Path

---------

Co-authored-by: Leon Zandman <[email protected]>
  • Loading branch information
erik-bershel and Leon Zandman authored Mar 29, 2024
1 parent 98d2bcc commit 9690ca4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions images/windows/scripts/build/Install-Wix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@

Install-ChocoPackage wixtoolset -ArgumentList "--force"

Update-Environment
$currentPath = [System.Environment]::GetEnvironmentVariable("PATH", "Machine")
$newPath = $currentPath + ";$(Join-Path -Path $env:WIX -ChildPath "bin")"
[Environment]::SetEnvironmentVariable("PATH", $newPath, "Machine")
Update-Environment

Invoke-PesterTests -TestFile "Wix"
13 changes: 13 additions & 0 deletions images/windows/scripts/tests/Wix.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@ Describe "Wix" {
It "Wix Toolset version from registry" {
$version | Should -Not -BeNullOrEmpty
}

It "Wix variable exists" {
$env:WIX | Should -Not -BeNullOrEmpty
}

It "Wix binaries folder exists" {
Test-Path -Path $(Join-Path -Path $env:WIX -ChildPath "bin") | Should -Be $true
}

It "Wix binaries folder is in PATH" {
$testPath = Join-Path -Path $env:WIX -ChildPath "bin"
$env:PATH -split ";" | Should -Contain "$testPath"
}
}

0 comments on commit 9690ca4

Please sign in to comment.