Remove Mock fallthrough #2654
Conversation
|
The error message is pretty terrible. We will see it only when there is no default behavior, so there must be at least 1 paramtrized mock. I tried to show what we evaluated in order to reach that point where no filter matched. but the wording needs to be better, and well as the formatting of the invoked filters I think. But then we should be able to re-use similar thing for Should -Invoke to show the history of execution, when failing should Invoke. To show the performed invocations. |
20b9cdd to
29d1756
Compare
29d1756 to
349ed05
Compare
|
Removed the orphan-bootstrap fallthrough entirely at 349ed05 — What happens now in the leaked-bootstrap case (outer
The pre-existing nested-Pester test ( Also fixed the two PSScriptAnalyzer warnings: 229/229 in Mock.Tests, 2183/0 full suite green on PS 7.6. |
3ef646b to
c5422e1
Compare
c5422e1 to
2b0ddf6
Compare
Doc-comments and debug messages in Pester.SessionState.Mock.ps1 still described the old behavior (calling through to the original command). Updated to reflect that unmatched calls now throw. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR Summary
Mock no longer falls through to the original command when no behavior matches. It throws instead. Fix #2178.
A separate message points at the bootstrap-leak case (outer Mock leaking into a nested
Invoke-Pesterwhose own mock table is empty) since there are no filters to show in that path.