mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Update Start-PSPester and Restore-PSPester cmdlets in build.psm1 to check for Pester 4.2 (#6667)
Update Start-PSPester and Restore-PSPester cmdlets in buil.psm1 to check for Pester 4.2 to support exception passthru.
This commit is contained in:
committed by
Travis Plunk
parent
5fd0d6962b
commit
e9b045e819
+12
-2
@@ -683,7 +683,7 @@ function Restore-PSPester
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $Destination = ([IO.Path]::Combine((Split-Path (Get-PSOptions -DefaultToNew).Output), "Modules"))
|
||||
)
|
||||
Save-Module -Name Pester -Path $Destination -Repository PSGallery
|
||||
Save-Module -Name Pester -Path $Destination -Repository PSGallery -RequiredVersion "4.2"
|
||||
}
|
||||
|
||||
function Compress-TestContent {
|
||||
@@ -992,7 +992,8 @@ function Start-PSPester {
|
||||
[switch]$IncludeFailingTest
|
||||
)
|
||||
|
||||
if (-not (Get-Module -ListAvailable -Name $Pester -ErrorAction SilentlyContinue))
|
||||
$getModuleResults = Get-Module -ListAvailable -Name $Pester -ErrorAction SilentlyContinue
|
||||
if (-not $getModuleResults)
|
||||
{
|
||||
Write-Warning @"
|
||||
Pester module not found.
|
||||
@@ -1002,6 +1003,15 @@ Restore the module to '$Pester' by running:
|
||||
return;
|
||||
}
|
||||
|
||||
if (-not ($getModuleResults | Where-Object { $_.Version -ge "4.2" } )) {
|
||||
Write-Warning @"
|
||||
No Pester module of version 4.2 and higher.
|
||||
Restore the required module version to '$Pester' by running:
|
||||
Restore-PSPester
|
||||
"@
|
||||
return;
|
||||
}
|
||||
|
||||
if ($IncludeFailingTest.IsPresent)
|
||||
{
|
||||
$Path += "$PSScriptRoot/tools/failingTests"
|
||||
|
||||
Reference in New Issue
Block a user