You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/functions/Pester.SessionState.Mock.ps1
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1201,7 +1201,9 @@ function Invoke-Mock {
1201
1201
# if we are targeting a module use the behaviors for the current module, but if there is no default the fall back to the non-module default behavior.
1202
1202
# do not fallback to non-module filtered behaviors. This is here for safety, and for compatibility when doing Mock Remove-Item {}, and then mocking in module
1203
1203
# then the default mock for Remove-Item should be effective.
1204
-
$behaviors=if ($targettingAModule) {
1204
+
1205
+
# using @() to always get array. This avoids null error in Invoke-MockInternal when no behaviors where found (if-else unwraps the lists)
1206
+
$behaviors=@(if ($targettingAModule) {
1205
1207
# we have default module behavior add it to the filtered behaviors if there are any
0 commit comments