Skip to content

Commit

Permalink
chocolateyGH-444 do not pass StopOnPackageFailure to choco
Browse files Browse the repository at this point in the history
  • Loading branch information
mwallner committed Oct 13, 2020
1 parent 67e3204 commit 648a36c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Boxstarter.Chocolatey/Chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function chocolatey {
$skipNextArg = $true
continue;
}
if (@("-StopOnPackageFailure", "--StopOnPackageFailure" -contains $a)) {
if (@("-StopOnPackageFailure", "--StopOnPackageFailure") -contains $a) {

This comment has been minimized.

Copy link
@mwallner

mwallner Oct 13, 2020

Author Owner

in fact, I just realized due to PowerShell magic both statements behave the same 🤦
nevertheless, I think it should be changed in order to be more concise

continue;
}
$argsWithoutBoxstarterSpecials += $a
Expand Down
20 changes: 20 additions & 0 deletions tests/Chocolatey/Chocolatey.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,26 @@ Describe "Call-Chocolatey" {
$passedArgs[7] | Should Be "-Verbose"
}
}

context "package parameters - Boxstarter exclusive parameters are stripped" {
$script:passedArgs = ""
Mock Invoke-LocalChocolatey { $script:passedArgs = $chocoArgs }

choco Install -y pkg -RebootCodes 123 --source blah --StopOnPackageFailure

$passedArgs | Should Not BeNullOrEmpty

it "passes expected params" {
$passedArgs.count | Should Be 5
}
it "passes all parameters in correct order" {
$passedArgs[0] | Should Be "Install"
$passedArgs[1] | Should Be "pkg" # package will always be first argument (reordering happens!)
$passedArgs[2] | Should Be "-y" # passed -y is after package because of the reordering
$passedArgs[3] | Should Be "--source"
$passedArgs[4] | Should Be "blah"
}
}
}

Describe "Get-PackageNamesFromInvocationLine" {
Expand Down

0 comments on commit 648a36c

Please sign in to comment.