-
Notifications
You must be signed in to change notification settings - Fork 905
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
(#3318) Add ShouldProcess support to rewritten helper cmdlets #3532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great addition, and I don't see any reason that we can't pull this into 2.4.0. I have left one minor comment, but other than that, this looks great!
tests/pester-tests/powershell-commands/Uninstall-ChocolateyPath.Tests.ps1
Outdated
Show resolved
Hide resolved
061a60e
to
707db73
Compare
@gep13 I think I've addressed both of those, thanks! Also rebased on develop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some standardization of the ShouldProcess
casing. Will need to make equivalent changes in the Pester tests.
707db73
to
a523d82
Compare
Some cmdlets should support ShouldProcess, this change ensures that they do correctly support it, along with adding checks to the underlying methods to make it work as users will expect. As Chocolatey CLI already supports --dry-run itself, this is primarily going to be useful for effectively unit testing the commands.
Update-SessionEnvironment, Set-EnvironmentVariable, and (Un)Install-ChocolateyPath implement ShouldProcess, so we can use -WhatIf to verify their behaviour with unit tests.
a523d82
to
c209065
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me.
Thanks for getting this fixed up @vexx32 👍 |
🎉 This issue has been resolved in version 2.4.0 🎉 The release is available on: |
Description Of Changes
Set-EnvironmentVariable
,Install-ChocolateyPath
,Uninstall-ChocolateyPath
, andUpdate-SessionEnvironment
VMOnly
so they do not run by default in typical dev environmentsMotivation and Context
In discussion with @gep13 we realised there is value in having the ability to non-destructively verify the logic paths taken in the code here. As such, I have augmented the existing commands and associated helper classes with ShouldProcess semantics to make this workable.
Testing
build.ps1
./Invoke-Tests.ps1 -Tags WhatIf
Operating Systems Testing
WIn10
Change Types Made
Change Checklist
Related Issue
Part of #3318
Docs PR: chocolatey/docs#1086