diff --git a/build.psm1 b/build.psm1 index 62397f6f4..ad3891a66 100644 --- a/build.psm1 +++ b/build.psm1 @@ -557,13 +557,14 @@ function Start-PSPester { [string]$Path = "$PSScriptRoot/test/powershell", [switch]$ThrowOnFailure, [switch]$FullCLR, - [string]$binDir = (Split-Path (New-PSOptions -FullCLR:$FullCLR).Output) + [string]$binDir = (Split-Path (New-PSOptions -FullCLR:$FullCLR).Output), + [string]$powershell = (Join-Path $binDir 'powershell'), + [string]$Pester = ([IO.Path]::Combine($binDir, "Modules", "Pester")) ) Write-Verbose "Running pester tests at '$path' with tag '$($Tag -join ''', ''')' and ExcludeTag '$($ExcludeTag -join ''', ''')'" -Verbose # All concatenated commands/arguments are suffixed with the delimiter (space) $Command = "" - $powershell = Join-Path $binDir 'powershell' # Windows needs the execution policy adjusted if ($IsWindows) { @@ -571,10 +572,9 @@ function Start-PSPester { } $startParams = @{binDir=$binDir} - $PesterModule = [IO.Path]::Combine($binDir, "Modules", "Pester") if(!$FullCLR) { - $Command += "Import-Module '$PesterModule'; " + $Command += "Import-Module '$Pester'; " } $Command += "Invoke-Pester " diff --git a/docker/launch.sh b/docker/launch.sh index 00558cc64..022c60f25 100755 --- a/docker/launch.sh +++ b/docker/launch.sh @@ -27,13 +27,13 @@ for build in $BUILDS; do image="$build/$distro" if [[ "$TEST" -eq 1 ]]; then echo "Testing $image" - command="cd PowerShell; Import-Module ./build.psm1; Install-Dotnet -NoSudo; Start-PSPester" + command="cd PowerShell; Import-Module ./build.psm1; Install-Dotnet -NoSudo; Start-PSPester -powershell powershell -Pester ./src/Modules/Shared/Pester" # clone repo for stable images because it's not already done if [[ "$build" = stable ]]; then command="git clone --recursive https://github.com/$FORK/PowerShell -b $BRANCH; $command" fi # run Pester tests inside container - docker run --rm -it powershell/powershell:$build-$distro powershell -c "$command" + docker run --rm -it powershell/powershell:$build-$distro -c "$command" else echo "Building $image" # copy the common script because it lives outside the docker build context