Open
Description
General summary of the issue
When using the new code coverage profiler ($PesterPreference.CodeCoverage.UseBreakpoints = $false
), Pester is reporting missing commands for parameter default value expressions.
ex:
[Int]$Temperature = (Get-Random -Maximum 100 -Minimum 0)
This is working, as expected, when using breakpoints ($PesterPreference.CodeCoverage.UseBreakpoints = $true
)
Describe your environment
Pester version : 5.3.1 C:\Client\PowerShell\Modules\Pester\5.3.1\Pester.psm1
PowerShell version : 7.2.1
OS version : Microsoft Windows NT 10.0.19042.0
Steps to reproduce
- Download and extract the PesterCCProfilerIssue.zip
- From the target directory, run:
.\Invoke-Tests.ps1
Expected Behavior
Should return no missing commands with 100% code coverage.
Current Behavior
Returns:
Covered 75% / 75%. 4 analyzed Commands in 1 File.
Missed command:
File Class Function Line Command
---- ----- -------- ---- -------
TestModule.psm1 Get-Temperature 6 Get-Random -Maximum 100 -Minimum 0
Possible Solution? (optional)
😕