Description
General summary of the issue
Using Pester 5.1.1 I had something like this:
It "calls Write-Progress" {
$tracker = [myCustomClass]::new(@(1))
Should -Invoke Write-Progress -Exactly 1
}
The constructor from [myCustomClass] would call a function that called another function which called Write-Progress. In 5.2.2 the above test fails where it would pass previously. What is going on here and how do I fix it?
Describe your environment
Pester version : 5.2.2 /Users/____/.local/share/powershell/Modules/Pester/5.2.2/Pester.psm1 PowerShell version : 7.1.3 OS version : Unix 11.0.0
EDIT
I guess I should edit to mention I found a solution but I may be looking for another one.
I was able to get it working again by specifying the module that Write-Progress should be called from and then again in Should-Invoke with -ModuleName.
So the question remains:
- What do you specify for Mock and Should -Invoke when you want to see how many times something was called from any module?