Skip to content

Commit

Permalink
Throw in Add-ShouldOperator when max number of operators is reached (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fflaten committed Oct 2, 2022
1 parent d5a07eb commit 9b21376
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ function Add-ShouldOperator {
return
}

# https://github.com/pester/Pester/issues/1355 and https://github.com/PowerShell/PowerShell/issues/9372
if ($script:AssertionOperators.Count -ge 32) {
throw 'Max number of assertion operators (32) has already been reached. This limitation is due to maximum allowed parameter sets in PowerShell.'
}

$namesToCheck = @(
$Name
$Alias
Expand Down

0 comments on commit 9b21376

Please sign in to comment.