Pester
Pester copied to clipboard
Throw in Add-ShouldOperator when max number of operators is reached
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 Requestto mark it as a draft. PR can be markedReady for reviewwhen it's ready.
- If not, use the arrow next to
- [ ] Tests are added/update (if required)
- [ ] Documentation is updated/added (if required)