Option to disable old assertions
nohwnd opened this issue · comments
Checklist
- Feature request has a meaningful title
- I have searched the existing issues. See all issues
- I have tested using the latest version of Pester. See Installation and update guide.
Summary of the feature request
When migrating to Assert assertions I want to disable them so I know that I did not migrate some of them.
When I already migrated, I want to keep the old assertions disabled, and they should fail with informative message when used.
How should it work?
Pester option is checked in all Shoud assertions and makes them fail when the option is disabled.
- add option
$pesterConfig.should.DisableV5
(default false) - write error from
Should
- write error from
Add-ShouldOperator Get-ShouldOperator
- skipping this is hard to do we don't have the settings at that point, and there is a lot of logic around it.
Looks good, but we could shorten it to Should.Disablev5
?
Could also be Should.Strict = 'v6'
to maybe support any future major changes 🤔 couldn't come up with anything else than Strict
for that one 😊
Looks good, but we could shorten it to
Should.Disablev5
?Could also be
Should.Strict = 'v6'
to maybe support any future major changes 🤔 couldn't come up with anything else thanStrict
for that one 😊
I agree. Should.DisableV5
or something like Should.Version = 'v5','v6'
Or maybe Should.DisableParameterSyntax
?
Or maybe
Should.DisableParameterSyntax
?
If it is used together with a value 'v5'
otherwise it could imply that it also affects parameters of the new Should-*
🤔
We could also use Should.DisableLegacy = $true
if it is the thought that the old Should
are made obsolete in v6 and will be removed in a future minor or major update? That property name could be used to disable any future functionality too. 🤔
Okay DisableV5
it is. It is the least ambiguous option, and it is short.