Skip to content

Commit 32993e5

Browse files
Remove Pester 5 if it exists (#6315)
* Remove Pester 5 if it exists * Add verbose switch Co-authored-by: Aditya Patwardhan <Aditya Patwardhan>
1 parent 696a045 commit 32993e5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ci-steps.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ steps:
2929

3030
# We run tests on Windows PowerShell. Changing to PowerShell core would need changes to the tests
3131
- powershell: |
32-
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -RequiredVersion 4.10.1
32+
$pester5 = Get-Module -Name Pester -ListAvailable | Where-Object { $_.Version.Major -ge 5 }
33+
34+
if ($pester5) {
35+
Write-Verbose -Message "Pester version 5+ found. Uninstalling it." -Verbose
36+
Uninstall-Module -Name Pester -MinimumVersion 5.0.0 -Verbose
37+
}
38+
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -RequiredVersion 4.10.1 -Verbose
3339
Import-Module "$(Build.SourcesDirectory)/tests/PowerShellDocsTests.psm1" -Force
3440
Invoke-Test
3541
displayName: Test

0 commit comments

Comments
 (0)