Pester icon indicating copy to clipboard operation
Pester copied to clipboard

Throw in Add-ShouldOperator when max number of operators is reached

Open fflaten opened this issue 3 years ago • 0 comments

PR Summary

Throws an exception when attempting to add a new operator when there's already 32 registered.

PowerShell only allows 32 parameter sets due to a uint-bitmask used to tag which sets a parameter is included in. This won't be fixed in Windows PowerShell and unfortunately PowerShell doesn't throw an exception due to a bug.

When the 33rd (or more) operators are added using Add-ShouldOperator it overflows and won't work. The new operator name will use a built-in behavior. Pester currently includes 26 operators, leaving only 6 functional slots for custom assertions per session.

Related #1355 Issue won't be fixed until operators are used without Should parameter sets.

PR Checklist

  • [x] PR has meaningful title
  • [x] Summary describes changes
  • [x] PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • [ ] Tests are added/update (if required)
  • [ ] Documentation is updated/added (if required)

fflaten avatar Aug 07 '22 21:08 fflaten