Open
Description
Describe your environment
Pester 5.3.1 on PSv5 and v7 on Win 10
Steps to reproduce
function outer
{
1..3 | inner
}
function inner
{
param
(
[Parameter(ValueFromPipeline)]$InputObject
)
# implicit end block, runs once
"RETURN"
}
Describe "unmocked" {
It "runs the end block" {
(outer).Count | Should -Be 1
}
}
Describe "mocked" {
It "runs the end block" {
Mock inner {"FOO"}
(outer).Count | Should -Be 1
}
}
Expected Behavior
Both tests pass
Current Behavior
Second test fails (because mock returns 1 object for each piped input)
Possible Solution? (optional)
Steppable pipeline. For sample code, run [System.Management.Automation.ProxyCommand]::Create([System.Management.Automation.CommandMetadata]::new((Get-Command New-Item)))