Add -powershell and -Pester options to Start-PSPester

When testing containers, we want to use the in-box PowerShell.
This commit is contained in:
Andrew Schwartzmeyer 2016-09-09 14:39:41 -07:00
parent 03237e91b6
commit e1e014295b
2 changed files with 6 additions and 6 deletions

View file

@ -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 "

View file

@ -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