From 7fcd54949f2cd3fe8b5dfcd4b932782597193f18 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Wed, 21 Aug 2024 08:47:02 -0400 Subject: [PATCH] Enhancement - Windows PowerShell 5.1 compatibility in actions_bootstrap.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')`. --- actions_bootstrap.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions_bootstrap.ps1 b/actions_bootstrap.ps1 index ab0f6e0..d4a4966 100644 --- a/actions_bootstrap.ps1 +++ b/actions_bootstrap.ps1 @@ -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