diff --git a/src/functions/assertions/PesterThrow.ps1 b/src/functions/assertions/PesterThrow.ps1 index 0fc126b64..d0c7cdec3 100644 --- a/src/functions/assertions/PesterThrow.ps1 +++ b/src/functions/assertions/PesterThrow.ps1 @@ -98,7 +98,7 @@ $filterOnMessage = -not [string]::IsNullOrWhitespace($ExpectedMessage) if ($filterOnMessage) { - $filters += "message like $(Format-Nicely [System.Management.Automation.WildcardPattern]::Unescape($ExpectedMessage))" + $filters += "message like $(Format-Nicely ([System.Management.Automation.WildcardPattern]::Unescape($ExpectedMessage)))" if ($actualExceptionWasThrown -and (-not (Get-DoValuesMatch $actualExceptionMessage $ExpectedMessage))) { $buts += "the message was $(Format-Nicely $actualExceptionMessage)" }