-
-
Notifications
You must be signed in to change notification settings - Fork 476
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
Allow -Mandatory:$false and -HasArgumentCompleter:$false in HaveParameter assertion #2223
Conversation
This is great, but seems inconsistent with the rest of our parameters. I understand it is consistent with PowerShell, but not with Pester syntax. I feel like there should be special |
I agree it's not ideal syntax, but what is? Do we have any We could use This is just submitted as a suggestion and I'm also fine with closing it and revisit later. |
In case you read the comment above early, I've made some edits. 🙂 |
@nohwnd Better? Keep current? Close and fix later? |
Sorry I've dropped the ball on this, do you want to finish it or should I close it? |
Depends on how you feel with the syntax. I'm fine with closing this, but the use case is valid and makes sense to support. Are we gonna have a Assert replacement for |
Yes there will be an alternative and I will be happy for your input on it :) |
PR Summary
Enables
Should -HaveParameter
to test that a parameter actually exists, but was not mandatory and/or did not have argument completer.Currently this was only covered by
Should -Not -HaveParameter abc -Mandatory -HasArgumentCompleter
which would also pass if the parameter was missing, requiring a leadingShould -HaveParameter abc
assertion to avoid false positive.The change does not break existing syntax and
-SwitchParam:$false
syntax is compatible a bool-parameter should it be changed in the future. So I don't believe this commits us to anything in the future that would require us to wait for new Should/Assert.Fix #2105
PR Checklist
Create Pull Request
to mark it as a draft. PR can be markedReady for review
when it's ready.