feat: only run on Pester 5.3.3 (#32)
* feat: only run on Pester 5.3.3 * fix: skip publisher check when installing Pester This is a legitimate skip, as the publisher between major Pester versions may change. * feat: ignore coverage results
This commit is contained in:
Родитель
e08908d5a0
Коммит
5f8fa49420
|
@ -136,6 +136,9 @@ _TeamCity*
|
|||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# Pester coverage
|
||||
coverage.xml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
|
|
|
@ -10,20 +10,22 @@ $testDir = Join-Path $parentDir -ChildPath "test"
|
|||
|
||||
# Debug info.
|
||||
$PSVersionTable | Out-String
|
||||
$RequiredPesterVersion = "5.3.3"
|
||||
|
||||
# List Pester versions.
|
||||
$pesterVersions = Get-Module -ListAvailable | Where-Object {$_.Name -eq "Pester" }
|
||||
$pesterVersions | % { Write-Host $_.Name $_.Version }
|
||||
$pesterVersions = Get-Module -ListAvailable | Where-Object {$_.Name -eq "Pester" -and $_.Version -eq $RequiredPesterVersion}
|
||||
|
||||
if ($pesterVersions.Count -eq 0) {
|
||||
Write-Warning "No Pester found, will install Pester 5.1.0"
|
||||
Write-Warning "Pester $RequiredPesterVersion not found, installing it."
|
||||
$InstallPester = $true
|
||||
}
|
||||
|
||||
if ($InstallPester) {
|
||||
Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 5.1.0
|
||||
Install-Module Pester -Force -Scope CurrentUser -RequiredVersion $RequiredPesterVersion -SkipPublisherCheck
|
||||
}
|
||||
|
||||
Get-Module -Name Pester | Remove-Module
|
||||
Import-Module Pester -RequiredVersion $RequiredPesterVersion
|
||||
|
||||
$FailedTests = Invoke-Pester $testDir -EnableExit -OutputFile "test/results.xml" -OutputFormat "NUnitXML" -CodeCoverage "$parentDir/FeatureFlags.psm1"
|
||||
if ($FailedTests -gt 0) {
|
||||
Write-Error "Error: $FailedTests Pester tests failed."
|
||||
|
|
Загрузка…
Ссылка в новой задаче