Skip to content

Commit 69a34ba

Browse files
authored
Fix Pester invocation for 3x versions (#2676)
1 parent 60e5648 commit 69a34ba

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

InvokePesterStub.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,19 @@ if ($All) {
105105
}
106106
Pester\Invoke-Pester -Configuration $configuration | Out-Null
107107
}
108-
else {
108+
elseif ($pesterModule.Version -ge '3.4.5') {
109+
# -Show was introduced in 3.4.5
109110
Pester\Invoke-Pester -Script $ScriptPath -PesterOption @{IncludeVSCodeMarker=$true} -Show $pester4Output
110111
}
112+
elseif ($pesterModule.Version -ge '3.4.0') {
113+
# -PesterOption was introduced before 3.4.0, and VSCodeMarker in 4.0.3-rc,
114+
# but because no-one checks the integrity of this hashtable we can call all of the versions
115+
# down to 3.4.0 like this
116+
Pester\Invoke-Pester -Script $ScriptPath -PesterOption @{IncludeVSCodeMarker=$true}
117+
}
118+
else {
119+
Pester\Invoke-Pester -Script $ScriptPath
120+
}
111121
}
112122
elseif (($LineNumber -match '\d+') -and ($pesterModule.Version -ge '4.6.0')) {
113123
if ($pesterModule.Version -ge '5.0.0') {

0 commit comments

Comments
 (0)