From 6374cfccb17194ab4eb74819f9d19bd043a6099f Mon Sep 17 00:00:00 2001 From: Joel Sallow <32407840+vexx32@users.noreply.github.com> Date: Fri, 10 Jul 2020 18:13:16 -0400 Subject: [PATCH 1/4] :white_check_mark: update code coverage config --- Build/Invoke-ModuleTests.ps1 | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Build/Invoke-ModuleTests.ps1 b/Build/Invoke-ModuleTests.ps1 index 59924d910..000bec1ce 100644 --- a/Build/Invoke-ModuleTests.ps1 +++ b/Build/Invoke-ModuleTests.ps1 @@ -11,8 +11,25 @@ Write-Host "TEST: Pester Version: $PesterVersion" Write-Host $Lines try { - # Try/Finally required since -CI will exit with exit code on failure. - Invoke-Pester -Path "$env:PROJECTROOT" -CI -Output Normal + # Try/Finally required since we will exit with exit code on failure. + Invoke-Pester -Configuration @{ + Run = @{ + Path = "$env:PROJECTROOT/Tests" + Exit = $true + } + CodeCoverage = @{ + Enabled = $true + Path = Get-ChildItem -Recurse -Include '*.ps1' -Path @( + "$env:PROJECTROOT/PSKoans/PSKoans.psm1" + "$env:PROJECTROOT/PSKoans/Public" + "$env:PROJECTROOT/PSKoans/Private" + ) + } + TestResult = @{ + Enabled = $true + TestSuiteName = "PSKoans-Pester" + } + } } finally { $Timestamp = Get-Date -Format "yyyyMMdd-hhmmss" From 5ad0858a5ece32d4bf4a80fed5826ce751b4602d Mon Sep 17 00:00:00 2001 From: "Joel Sallow (/u/ta11ow)" <32407840+vexx32@users.noreply.github.com> Date: Fri, 17 Jul 2020 14:07:45 -0400 Subject: [PATCH 2/4] :rocket: Update pester configuration Manually cast nested configuration options to their respective concrete types --- Build/Invoke-ModuleTests.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Build/Invoke-ModuleTests.ps1 b/Build/Invoke-ModuleTests.ps1 index 000bec1ce..d39ad6e46 100644 --- a/Build/Invoke-ModuleTests.ps1 +++ b/Build/Invoke-ModuleTests.ps1 @@ -13,19 +13,20 @@ Write-Host $Lines try { # Try/Finally required since we will exit with exit code on failure. Invoke-Pester -Configuration @{ - Run = @{ + Run = [Pester.RunConfiguration]@{ Path = "$env:PROJECTROOT/Tests" Exit = $true } - CodeCoverage = @{ + CodeCoverage = [Pester.CodeCoverageConfiguration]@{ Enabled = $true Path = Get-ChildItem -Recurse -Include '*.ps1' -Path @( "$env:PROJECTROOT/PSKoans/PSKoans.psm1" "$env:PROJECTROOT/PSKoans/Public" "$env:PROJECTROOT/PSKoans/Private" - ) + ) | + Select-Object -ExpandProperty FullName } - TestResult = @{ + TestResult = [Pester.TestResultConfiguration]@{ Enabled = $true TestSuiteName = "PSKoans-Pester" } From f0464e07e79a161928df93f95605171a4c9b6903 Mon Sep 17 00:00:00 2001 From: "Joel Sallow (/u/ta11ow)" <32407840+vexx32@users.noreply.github.com> Date: Fri, 17 Jul 2020 14:16:26 -0400 Subject: [PATCH 3/4] :rocket: Manually build Pester configuration --- Build/Invoke-ModuleTests.ps1 | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/Build/Invoke-ModuleTests.ps1 b/Build/Invoke-ModuleTests.ps1 index d39ad6e46..b1db2fb76 100644 --- a/Build/Invoke-ModuleTests.ps1 +++ b/Build/Invoke-ModuleTests.ps1 @@ -12,25 +12,19 @@ Write-Host $Lines try { # Try/Finally required since we will exit with exit code on failure. - Invoke-Pester -Configuration @{ - Run = [Pester.RunConfiguration]@{ - Path = "$env:PROJECTROOT/Tests" - Exit = $true - } - CodeCoverage = [Pester.CodeCoverageConfiguration]@{ - Enabled = $true - Path = Get-ChildItem -Recurse -Include '*.ps1' -Path @( - "$env:PROJECTROOT/PSKoans/PSKoans.psm1" - "$env:PROJECTROOT/PSKoans/Public" - "$env:PROJECTROOT/PSKoans/Private" - ) | - Select-Object -ExpandProperty FullName - } - TestResult = [Pester.TestResultConfiguration]@{ - Enabled = $true - TestSuiteName = "PSKoans-Pester" - } - } + $configuration = [PesterConfiguration]::Default + $configuration.Run.Path = "$env:PROJECTROOT/Tests" + $configuration.Run.Exit = $true + $configuration.CodeCoverage.Enabled = $true + $configuration.CodeCoverage.Path = Get-ChildItem -Recurse -Include '*.ps1' -Path @( + "$env:PROJECTROOT/PSKoans/PSKoans.psm1" + "$env:PROJECTROOT/PSKoans/Public" + "$env:PROJECTROOT/PSKoans/Private" + ) | Select-Object -ExpandProperty FullName + $configuration.TestResult.Enabled = $true + $configuration.TestResult.TestSuiteName = "PSKoans-Pester + + Invoke-Pester -Configuration $configuration } finally { $Timestamp = Get-Date -Format "yyyyMMdd-hhmmss" From da1885dcc62f0c78772cfc7aebb29e9813f6909f Mon Sep 17 00:00:00 2001 From: "Joel Sallow (/u/ta11ow)" <32407840+vexx32@users.noreply.github.com> Date: Fri, 17 Jul 2020 14:28:55 -0400 Subject: [PATCH 4/4] :recycle: Fix typo --- Build/Invoke-ModuleTests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/Invoke-ModuleTests.ps1 b/Build/Invoke-ModuleTests.ps1 index b1db2fb76..7c9ab7c56 100644 --- a/Build/Invoke-ModuleTests.ps1 +++ b/Build/Invoke-ModuleTests.ps1 @@ -22,7 +22,7 @@ try { "$env:PROJECTROOT/PSKoans/Private" ) | Select-Object -ExpandProperty FullName $configuration.TestResult.Enabled = $true - $configuration.TestResult.TestSuiteName = "PSKoans-Pester + $configuration.TestResult.TestSuiteName = "PSKoans-Pester" Invoke-Pester -Configuration $configuration }