POV: I'm generating Powershell test code coverage with pester.
Problem: The generated Coverage.xml file remains empty.
Question What am I doing wrong?
Some technicalities:
Write-Verbose -Message "Running Pester Tests"
$conf = New-PesterConfiguration
$conf.Run.Path= ".\Tests\"
$conf.Run.TestExtension = '.Unit.Test.ps1'
$conf.Output.CIFormat = "AzureDevops"
$conf.TestResult.Enabled = $true
$conf.TestResult.OutputPath = './TestResults/Testresult.xml'
$conf.CodeCoverage.Enabled = $true
$conf.CodeCoverage.OutputFormat = 'JaCoCo'
$conf.CodeCoverage.CoveragePercentTarget = 70
$conf.CodeCoverage.RecursePaths = $true
$conf.CodeCoverage.OutputPath="./TestResults/Coverage.xml"
$conf.CodeCoverage.Path=".\Tests\*.Unit.Test.ps1"
Invoke-Pester -Configuration $conf
> Get-Module Pester | Where-Object {$_.Version -gt '5.0.0'}
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 5.4.0 Pester {Add-ShouldOperator, AfterAll, AfterEach, Assert-MockCalled…}
> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.1
PSEdition Core
GitCommitId 7.3.1
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0