From d2e08a6747c23e4799478aa0f864547034528e24 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Mon, 4 May 2020 08:34:31 +0200 Subject: [PATCH] Fix Pester invocation for 3x versions --- InvokePesterStub.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/InvokePesterStub.ps1 b/InvokePesterStub.ps1 index cdb6cb1216..b1bcb75f61 100755 --- a/InvokePesterStub.ps1 +++ b/InvokePesterStub.ps1 @@ -105,9 +105,19 @@ if ($All) { } Pester\Invoke-Pester -Configuration $configuration | Out-Null } - else { + elseif ($pesterModule.Version -ge '3.4.5') { + # -Show was introduced in 3.4.5 Pester\Invoke-Pester -Script $ScriptPath -PesterOption @{IncludeVSCodeMarker=$true} -Show $pester4Output } + elseif ($pesterModule.Version -ge '3.4.0') { + # -PesterOption was introduced before 3.4.0, and VSCodeMarker in 4.0.3-rc, + # but because no-one checks the integrity of this hashtable we can call all of the versions + # down to 3.4.0 like this + Pester\Invoke-Pester -Script $ScriptPath -PesterOption @{IncludeVSCodeMarker=$true} + } + else { + Pester\Invoke-Pester -Script $ScriptPath + } } elseif (($LineNumber -match '\d+') -and ($pesterModule.Version -ge '4.6.0')) { if ($pesterModule.Version -ge '5.0.0') {