From 30e05cc11854af4ecc15a1101e8a2ae5661d9daa Mon Sep 17 00:00:00 2001 From: Rob Sewell Date: Tue, 9 May 2023 11:19:21 +0000 Subject: [PATCH] so thtat we dont load the v5 peseter version when we want v4 #897 --- source/functions/Invoke-DbcCheck.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/functions/Invoke-DbcCheck.ps1 b/source/functions/Invoke-DbcCheck.ps1 index eaafedf3..de25dae8 100644 --- a/source/functions/Invoke-DbcCheck.ps1 +++ b/source/functions/Invoke-DbcCheck.ps1 @@ -288,11 +288,13 @@ function Invoke-DbcCheck { process { if ($legacy) { try { + Write-PSFMessage 'Running in legacy mode, we need Version 4' if (Get-Module Pester | Where-Object { $_.Version -gt '5.0.0' }) { + Write-PSFMessage 'Remove Version 5' -Level Verbose Remove-Module Pester -ErrorAction SilentlyContinue - Write-PSFMessage 'Running in legacy mode, we need to import Version 4' -Level Verbose - Import-Module Pester -RequiredVersion 4.10.1 -Global } + Write-PSFMessage 'import Version 4' -Level Verbose + Import-Module Pester -RequiredVersion 4.10.1 -Global } catch { Write-PSFMessage -Message 'Something Went wrong' -Level Warning -ErrorRecord $_ Return