@@ -161,7 +161,7 @@ function Get-CodecovReport($Results, $ModuleBase) {
161
161
162
162
function Get-PesterTestVersion ($testFilePath ) {
163
163
$testFileContent = Get-Content - Path $testFilePath - Raw
164
- if ($testFileContent -Like ' *#pester5* ' )
164
+ if ($testFileContent -match ' HaveParameter ' )
165
165
{
166
166
return ' 5'
167
167
}
@@ -205,7 +205,7 @@ if (-not $Finalize) {
205
205
# we're in the "region" of pester 4, so skip
206
206
continue
207
207
}
208
-
208
+
209
209
# opt-in
210
210
if ($IncludeCoverage ) {
211
211
$CoverFiles = Get-CoverageIndications - Path $f - ModuleBase $ModuleBase
@@ -234,7 +234,7 @@ if (-not $Finalize) {
234
234
}
235
235
}
236
236
}
237
-
237
+
238
238
# start the round for pester 5 tests
239
239
# Remove any previously loaded pester module
240
240
Remove-Module - Name pester - ErrorAction SilentlyContinue
@@ -244,7 +244,7 @@ if (-not $Finalize) {
244
244
$Counter = 0
245
245
foreach ($f in $AllTestsWithinScenario ) {
246
246
$Counter += 1
247
-
247
+
248
248
# get if this test should run on pester 4 or pester 5
249
249
$pesterVersionToUse = Get-PesterTestVersion - testFilePath $f.FullName
250
250
if ($pesterVersionToUse -eq ' 4' ) {
@@ -262,7 +262,7 @@ if (-not $Finalize) {
262
262
$pester5Config.CodeCoverage.OutputFormat = ' JaCoCo'
263
263
$pester5Config.CodeCoverage.OutputPath = " $ModuleBase \Pester5Coverage$PSVersion$Counter .xml"
264
264
}
265
-
265
+
266
266
$trialNo = 1
267
267
while ($trialNo -le 3 ) {
268
268
if ($trialNo -eq 1 ) {
@@ -283,7 +283,7 @@ if (-not $Finalize) {
283
283
}
284
284
}
285
285
}
286
-
286
+
287
287
# Gather support package as an artifact
288
288
# New-DbatoolsSupportPackage -Path $ModuleBase - turns out to be too heavy
289
289
try {
0 commit comments