diff --git a/images/windows/scripts/build/Install-Wix.ps1 b/images/windows/scripts/build/Install-Wix.ps1 index 0fd90bf329df..d94d03da1b09 100644 --- a/images/windows/scripts/build/Install-Wix.ps1 +++ b/images/windows/scripts/build/Install-Wix.ps1 @@ -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" diff --git a/images/windows/scripts/tests/Wix.Tests.ps1 b/images/windows/scripts/tests/Wix.Tests.ps1 index 66937f696969..cf6fc2fdf1ba 100644 --- a/images/windows/scripts/tests/Wix.Tests.ps1 +++ b/images/windows/scripts/tests/Wix.Tests.ps1 @@ -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" + } }