Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/functions/Mock.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ function Should-InvokeInternal {
$nonMatchingCalls = [System.Collections.Generic.List[object]]@()

# Check for variables in ParameterFilter that already exists in session. Risk of conflict
if ($PesterPreference.Debug.WriteDebugMessages.Value) {
# Excluding native applications as they don't have parameters or metadata. Will always use $args
if ($PesterPreference.Debug.WriteDebugMessages.Value -and
$null -ne $ContextInfo.Hook.Metadata -and
$ContextInfo.Hook.Metadata.Parameters.Count -gt 0) {
$preExistingFilterVariables = @{}
foreach ($v in $filter.Ast.FindAll( { $args[0] -is [System.Management.Automation.Language.VariableExpressionAst] }, $true)) {
if (-not $preExistingFilterVariables.ContainsKey($v.VariablePath.UserPath)) {
Expand Down