Skip to content

Commit

Permalink
Move tests from script to Pester
Browse files Browse the repository at this point in the history
  • Loading branch information
erik-bershel committed Mar 28, 2024
1 parent f49fc5a commit 8c2ee1d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
13 changes: 4 additions & 9 deletions images/windows/scripts/build/Install-Wix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@
Install-ChocoPackage wixtoolset -ArgumentList "--force"

Update-Environment

$wixBinPath = Join-Path -Path $env:WIX -ChildPath 'bin'
if (Test-Path $wixBinPath) {
$currentPath = [System.Environment]::GetEnvironmentVariable("PATH", "Machine")
$newPath = $currentPath + ";$wixBinPath"
[Environment]::SetEnvironmentVariable("PATH", $newPath, "Machine")
} else {
Write-Error "WIX binaries folder ($wixBinPath) not found."
}
$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"
12 changes: 10 additions & 2 deletions images/windows/scripts/tests/Wix.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ Describe "Wix" {
$version | Should -Not -BeNullOrEmpty
}

It "Wix binaries are available" {
candle.exe -? | Should -Not -BeNullOrEmpty
It "Wix variable exists" {
$env:WIX | Should -Not -BeNullOrEmpty
}

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

It "Wix binaries folder is in PATH" {
$env:PATH -split ";" | Should -Contain "$env:WIX\bin"
}
}

0 comments on commit 8c2ee1d

Please sign in to comment.