Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Oct 2, 2022

Conversation

fflaten
Copy link
Collaborator

@fflaten fflaten commented Aug 7, 2022

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

  • PR has meaningful title
  • Summary describes changes
  • 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)

@nohwnd nohwnd merged commit 9b21376 into pester:main Oct 2, 2022
@fflaten fflaten deleted the max-operators branch October 2, 2022 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants