From ad6788188cdb42fdd6ea6a4e7b2334fc012483e2 Mon Sep 17 00:00:00 2001 From: Simone Bizzotto Date: Wed, 23 Oct 2024 22:07:21 +0200 Subject: [PATCH] pester runner, detection based on standard Requires directive --- tests/Invoke-DbaQuery.Tests.ps1 | 2 +- tests/appveyor.pester.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Invoke-DbaQuery.Tests.ps1 b/tests/Invoke-DbaQuery.Tests.ps1 index 9636656cbc..640b561857 100644 --- a/tests/Invoke-DbaQuery.Tests.ps1 +++ b/tests/Invoke-DbaQuery.Tests.ps1 @@ -1,4 +1,4 @@ -#HaveParameter - yeah, I know. +#Requires -Module @{ ModuleName="Pester"; ModuleVersion="5.0"} BeforeAll { $CommandName = (Get-Item $PSCommandPath).Name.Replace(".Tests.ps1", "") diff --git a/tests/appveyor.pester.ps1 b/tests/appveyor.pester.ps1 index 038cd00a01..a505853f14 100644 --- a/tests/appveyor.pester.ps1 +++ b/tests/appveyor.pester.ps1 @@ -162,7 +162,7 @@ function Get-CodecovReport($Results, $ModuleBase) { function Get-PesterTestVersion($testFilePath) { $testFileContent = Get-Content -Path $testFilePath -Raw - if ($testFileContent -match 'HaveParameter') + if ($testFileContent -match '#Requires\s+-Module\s+@\{\s+ModuleName="Pester";\s+ModuleVersion="5\.') { return '5' }