Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pester: Install latest version on WMF builds and skip installation if version is new enough for Azure DevOps which now ships with Pester #1629

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions tools/appveyor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
$ErrorActionPreference = 'Stop'

function Install-Pester {
$requiredPesterVersion = '5.0.2'
$pester = Get-Module Pester -ListAvailable | Where-Object { $_.Version -eq $requiredPesterVersion }
$pester = Get-Module Pester -ListAvailable | Where-Object { $_.Version -gt [version]'5.1' }
if ($null -eq $pester) {
if ($null -eq (Get-Module -ListAvailable PowershellGet)) {
# WMF 4 image build
Write-Verbose -Verbose "Installing Pester via nuget"
nuget install Pester -Version $requiredPesterVersion -source https://www.powershellgallery.com/api/v2 -outputDirectory "$env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion
nuget install Pester -source https://www.powershellgallery.com/api/v2 -outputDirectory "$env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion
}
else {
# Visual Studio 2017 build (has already Pester v3, therefore a different installation mechanism is needed to make it also use the new version 4)
Expand Down