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

Option to disable old assertions #2495

Closed
5 of 6 tasks
nohwnd opened this issue Jun 10, 2024 · 7 comments · Fixed by #2500
Closed
5 of 6 tasks

Option to disable old assertions #2495

nohwnd opened this issue Jun 10, 2024 · 7 comments · Fixed by #2500
Labels
Assertions For issues related with assertions Feature
Milestone

Comments

@nohwnd
Copy link
Member

nohwnd commented Jun 10, 2024

Checklist

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.
@nohwnd nohwnd added the Feature label Jun 10, 2024
@nohwnd nohwnd added this to the 6.0.0 milestone Jun 10, 2024
@nohwnd nohwnd added the Assertions For issues related with assertions label Jun 10, 2024
@nohwnd
Copy link
Member Author

nohwnd commented Jun 12, 2024

$c.Should.DisableShouldV5 = $true

@johlju @fflaten how does this look like to you?

@johlju
Copy link
Contributor

johlju commented Jun 12, 2024

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 😊

@fflaten
Copy link
Collaborator

fflaten commented Jun 12, 2024

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 😊

I agree. Should.DisableV5 or something like Should.Version = 'v5','v6'

@nohwnd
Copy link
Member Author

nohwnd commented Jun 12, 2024

Or maybe Should.DisableParameterSyntax?

@johlju
Copy link
Contributor

johlju commented Jun 13, 2024

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-* 🤔

@johlju
Copy link
Contributor

johlju commented Jun 13, 2024

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. 🤔

@nohwnd
Copy link
Member Author

nohwnd commented Jun 13, 2024

Okay DisableV5 it is. It is the least ambiguous option, and it is short.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Assertions For issues related with assertions Feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants