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
|
*.coverage
|
||||||
*.coveragexml
|
*.coveragexml
|
||||||
|
|
||||||
|
# Pester coverage
|
||||||
|
coverage.xml
|
||||||
|
|
||||||
# NCrunch
|
# NCrunch
|
||||||
_NCrunch_*
|
_NCrunch_*
|
||||||
.*crunch*.local.xml
|
.*crunch*.local.xml
|
||||||
|
|
|
@ -10,20 +10,22 @@ $testDir = Join-Path $parentDir -ChildPath "test"
|
||||||
|
|
||||||
# Debug info.
|
# Debug info.
|
||||||
$PSVersionTable | Out-String
|
$PSVersionTable | Out-String
|
||||||
|
$RequiredPesterVersion = "5.3.3"
|
||||||
|
|
||||||
# List Pester versions.
|
$pesterVersions = Get-Module -ListAvailable | Where-Object {$_.Name -eq "Pester" -and $_.Version -eq $RequiredPesterVersion}
|
||||||
$pesterVersions = Get-Module -ListAvailable | Where-Object {$_.Name -eq "Pester" }
|
|
||||||
$pesterVersions | % { Write-Host $_.Name $_.Version }
|
|
||||||
|
|
||||||
if ($pesterVersions.Count -eq 0) {
|
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
|
$InstallPester = $true
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($InstallPester) {
|
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"
|
$FailedTests = Invoke-Pester $testDir -EnableExit -OutputFile "test/results.xml" -OutputFormat "NUnitXML" -CodeCoverage "$parentDir/FeatureFlags.psm1"
|
||||||
if ($FailedTests -gt 0) {
|
if ($FailedTests -gt 0) {
|
||||||
Write-Error "Error: $FailedTests Pester tests failed."
|
Write-Error "Error: $FailedTests Pester tests failed."
|
||||||
|
|
Загрузка…
Ссылка в новой задаче