diff --git a/tests/chocolatey-tests/choco-install.Tests.ps1 b/tests/chocolatey-tests/choco-install.Tests.ps1 index 2a810317b5..e7e513c223 100644 --- a/tests/chocolatey-tests/choco-install.Tests.ps1 +++ b/tests/chocolatey-tests/choco-install.Tests.ps1 @@ -199,6 +199,101 @@ Describe "choco install" -Tag Chocolatey, InstallCommand { It "Outputs a message indicating that missingpackage was not installed" { $Output.Lines | Should -Contain "missingpackage not installed. The package was not found with the source(s) listed." } + + Context "packages.config containing all options" { + BeforeAll { + @" + + + + +"@ | Out-File $env:CHOCOLATEY_TEST_PACKAGES_PATH\alloptions.packages.config -Encoding utf8 + + $Output = Invoke-Choco install $env:CHOCOLATEY_TEST_PACKAGES_PATH\alloptions.packages.config --confirm --verbose --debug + + # This is based on two observations: The addition explicitly outputs that it's the Package Configuration. + # The configuration output is also about 80 lines. + $StartofPackageConfiguration = [array]::IndexOf($Output.Lines, "Package Configuration: CommandName='install'|") + $PackageConfigurationOutput = $Output.Lines[$StartofPackageConfiguration..($StartofPackageConfiguration+80)] -join [Environment]::NewLine + } + + # We are explicitly passing in a bad username and password here. + # Therefore it cannot find the package to install and fails the install. + # That doesn't matter because we just need to test that the configuration is set properly. + It "Should exit Failure (1)" { + $Output.ExitCode | Should -Be 1 -Because $Output.String + } + + It "Should contain the expected configuration option (