Skip to content

Commit 4a7d164

Browse files
bergmeisterChristoph Bergmeister
and
Christoph Bergmeister
authored
Pin major version of Pester to 4 and upgrade Pester version for WMF4 build (#1433)
Co-authored-by: Christoph Bergmeister <[email protected]>
1 parent 128a9a2 commit 4a7d164

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Note: the PSScriptAnalyzer Chocolatey package is provided and supported by the c
108108
#### Requirements
109109

110110
* [.NET Core 3.1.102 SDK](https://www.microsoft.com/net/download/dotnet-core/3.1#sdk-3.1.102) or newer patch release
111+
* [Pester v4 PowerShell module, available on PowerShell Gallery](https://github.com/pester/Pester)
111112
* [PlatyPS PowerShell module, available on PowerShell Gallery](https://github.com/PowerShell/platyPS/releases)
112113
* Optionally but recommended for development: [Visual Studio 2017/2019](https://www.visualstudio.com/downloads/)
113114

build.psm1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,14 @@ function Test-ScriptAnalyzer
331331
}
332332
$savedModulePath = $env:PSModulePath
333333
$env:PSModulePath = "${testModulePath}{0}${env:PSModulePath}" -f [System.IO.Path]::PathSeparator
334+
$importPesterV4 = 'Import-Module -Name Pester -MaximumVersion 4.99'
334335
if ($ShowAll)
335336
{
336-
$scriptBlock = [scriptblock]::Create("Invoke-Pester -Path $testScripts -OutputFormat NUnitXml -OutputFile $testResultsFile")
337+
$scriptBlock = [scriptblock]::Create("$importPesterV4; Invoke-Pester -Path $testScripts -OutputFormat NUnitXml -OutputFile $testResultsFile")
337338
}
338339
else
339340
{
340-
$scriptBlock = [scriptblock]::Create("Invoke-Pester -Path $testScripts -OutputFormat NUnitXml -OutputFile $testResultsFile -Show Describe,Summary,Failed")
341+
$scriptBlock = [scriptblock]::Create("$importPesterV4; Invoke-Pester -Path $testScripts -OutputFormat NUnitXml -OutputFile $testResultsFile -Show Describe,Summary,Failed")
341342
}
342343
if ( $InProcess ) {
343344
& $scriptBlock

tools/appveyor.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
$ErrorActionPreference = 'Stop'
55

66
function Install-Pester {
7-
$requiredPesterVersion = '4.10.0'
7+
$requiredPesterVersion = '4.10.1'
88
$pester = Get-Module Pester -ListAvailable | Where-Object { $_.Version -eq $requiredPesterVersion }
99
if ($null -eq $pester) {
1010
if ($null -eq (Get-Module -ListAvailable PowershellGet)) {
@@ -15,7 +15,7 @@ function Install-Pester {
1515
else {
1616
# Visual Studio 2017 build (has already Pester v3, therefore a different installation mechanism is needed to make it also use the new version 4)
1717
Write-Verbose -Verbose "Installing Pester via Install-Module"
18-
Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser -Repository PSGallery
18+
Install-Module -Name Pester -MaximumVersion 4.99 -Force -SkipPublisherCheck -Scope CurrentUser -Repository PSGallery
1919
}
2020
}
2121
}

0 commit comments

Comments
 (0)