Skip to content

Commit

Permalink
Enhancement - Windows PowerShell 5.1 compatibility in actions_bootstr…
Browse files Browse the repository at this point in the history
…ap.ps1

Enhanced Windows check while installing Pester to support Windows PowerShell 5.1. It currently checks for $IsWindows, which was only introduced in PowerShell 6.

I updated it to `-and ($IsWindows -or $PSVersionTable.PSVersion -ge [version]'5.1')` but if minimal code is desired, it could be simplified to `-and $PSVersionTable.PSVersion -ge [version]'5.1')`.
  • Loading branch information
SamErde authored Aug 21, 2024
1 parent 6ed822c commit 7fcd549
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actions_bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ foreach ($module in $modulesToInstall) {
ErrorAction = 'Stop'
}
try {
if ($module.ModuleName -eq 'Pester' -and $IsWindows) {
if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -ge [version]'5.1')) {
# special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389
# this only affects windows builds
Install-Module @installSplat -SkipPublisherCheck
Expand Down

0 comments on commit 7fcd549

Please sign in to comment.