1717function SuiteSetup {
1818 Import-Module " $PSScriptRoot \PSGetTestUtils.psm1" - WarningAction SilentlyContinue
1919 Import-Module " $PSScriptRoot \Asserts.psm1" - WarningAction SilentlyContinue
20-
20+
2121 $script :IsWindowsOS = (-not (Get-Variable - Name IsWindows - ErrorAction Ignore)) -or $IsWindows
2222 $script :ProgramFilesModulesPath = Get-AllUsersModulesPath
2323 $script :MyDocumentsModulesPath = Get-CurrentUserModulesPath
@@ -64,7 +64,7 @@ function SuiteSetup {
6464 $script :TestPSModulePath = Join-Path - Path $script :TempPath - ChildPath " PSGet_$ ( Get-Random ) "
6565 $null = New-Item - Path $script :TempModulesPath - ItemType Directory - Force
6666 $null = New-Item - Path $script :TestPSModulePath - ItemType Directory - Force
67-
67+
6868 # Set up local "gallery"
6969 $script :localGalleryName = [System.Guid ]::NewGuid().ToString()
7070 $script :PSGalleryRepoPath = Join-Path - Path $script :TempPath - ChildPath ' PSGalleryRepo'
@@ -88,7 +88,7 @@ function SuiteSetup {
8888
8989 $null = New-ModuleManifest - Path (Join-Path - Path $pesterv1Destination - ChildPath " Pester.psd1" ) - Description " Test signed module v1" - ModuleVersion 99.99 .99.98
9090 $null = New-ModuleManifest - Path (Join-Path - Path $pesterv2Destination - ChildPath " Pester.psd1" ) - Description " Test signed module v2" - ModuleVersion 99.99 .99.99
91-
91+
9292 # Move Pester 3.4.0 to $script:TestPSModulePath
9393 # If it doesn't exist, attempt to download it.
9494 # If this is run offline, just fail the test for now.
@@ -150,7 +150,7 @@ function SuiteCleanup {
150150 }
151151 }
152152 }
153-
153+
154154 RemoveItem $script :TempModulesPath
155155 RemoveItem $script :TestPSModulePath
156156}
@@ -172,6 +172,28 @@ Describe PowerShell.PSGet.InstallModuleTests -Tags 'BVT','InnerLoop' {
172172 PSGetTestUtils\Uninstall-Module DscTestModule
173173 }
174174
175+ # Purpose: InstallShouldBeSilent
176+ #
177+ # Action: Install-Module "ContosoServer"
178+ #
179+ # Expected Result: Should pass
180+ #
181+ It " Install-Module ContosoServer should return be silent" {
182+ $result = Install-Module - Name " ContosoServer"
183+ $result | Should - BeNullOrEmpty
184+ }
185+
186+ # Purpose: InstallShouldReturnOutput
187+ #
188+ # Action: Install-Module "ContosoServer" -PassThru
189+ #
190+ # Expected Result: Should pass
191+ #
192+ It " Install-Module ContosoServer -PassThru should return output" {
193+ $result = Install-Module - Name " ContosoServer" - PassThru
194+ $result | Should -Not - BeNullOrEmpty
195+ }
196+
175197 # Purpose: InstallNotAvailableModuleWithWildCard
176198 #
177199 # Action: Install-Module "Co[nN]t?soS[a-z]r?eW"
@@ -624,7 +646,7 @@ Describe PowerShell.PSGet.InstallModuleTests -Tags 'BVT','InnerLoop' {
624646 - RedirectStandardOutput $NonAdminConsoleOutput
625647 waitFor {Test-Path $NonAdminConsoleOutput } - timeoutInMilliseconds $script :assertTimeOutms - exceptionMessage " Install-Module on non-admin console failed to complete"
626648 $content = Get-Content $NonAdminConsoleOutput
627-
649+
628650 Assert ($content -and ($content -match ' DscTestModule' )) " Install-module with -force should fail when a module version being installed is in use, $content ."
629651 RemoveItem $NonAdminConsoleOutput
630652 } `
@@ -847,7 +869,7 @@ Describe PowerShell.PSGet.InstallModuleTests -Tags 'BVT','InnerLoop' {
847869
848870 # Because of TFS:1908563, we changed Get-Package to show only the latest version by default
849871 # hence the count is same after the update.
850- AssertEquals $modules1.count $modules2.count " module count should be same before and after updating a module, before: $ ( $modules1.count ) , after: $ ( $modules2.count ) "
872+ AssertEquals $modules1.count $modules2.count " module count should be same before and after updating a module, before: $ ( $modules1.count ) , after: $ ( $modules2.count ) "
851873 }
852874
853875 It ValidateGetInstalledModuleAndUninstallModuleCmdletsWithMinimumVersion {
@@ -1054,7 +1076,7 @@ Describe PowerShell.PSGet.InstallModuleTests.P1 -Tags 'P1','OuterLoop' {
10541076 #
10551077 # Expected Result: should fail with an error
10561078 #
1057- It " InstallModuleWithRangeWildCards" {
1079+ It " InstallModuleWithRangeWildCards" {
10581080 AssertFullyQualifiedErrorIdEquals - scriptblock {Install-Module - Name " Co[nN]t?soS[a-z]r?er" } `
10591081 - expectedFullyQualifiedErrorId ' NameShouldNotContainWildcardCharacters,Install-Module'
10601082 }
@@ -1338,28 +1360,28 @@ Describe PowerShell.PSGet.InstallModuleTests.P1 -Tags 'P1','OuterLoop' {
13381360 #
13391361 It GetInstalledModuleWithWildcard {
13401362 $ModuleNames = ' Contoso' , ' ContosoServer' , ' ContosoClient'
1341-
1363+
13421364 Install-Module - Name $ModuleNames
13431365
13441366 # ModuleName without wildcards
13451367 $res1 = Get-InstalledModule - Name $ModuleNames [0 ]
13461368 AssertEquals $res1.Name $ModuleNames [0 ] " Get-InstalledModule didn't return the exact module, $res1 "
1347-
1369+
13481370 # ModuleName with wildcards
13491371 $res2 = Get-InstalledModule - Name " Contoso*"
13501372 AssertEquals $res2.count $ModuleNames.Count " Get-InstalledModule didn't return the $ModuleNames modules, $res2 "
13511373 }
13521374
13531375 # Purpose: Validate Install-Module cmdlet with same source location registered with NUGet provider
13541376 #
1355- # Expected Result: Get-InstalledModule should return proper Repository and RepositorySourceLocation values
1377+ # Expected Result: Get-InstalledModule should return proper Repository and RepositorySourceLocation values
13561378 # from the PowerShellGet provider only not from the NuGet provider
13571379 #
13581380 It InstallModuleWithSameLocationRegisteredWithNuGetProvider {
13591381 $ModuleName = ' ContosoServer'
13601382 $TempNuGetSourceName = " $ ( Get-Random ) "
13611383 $RepositoryName = " PSGallery"
1362- Register-PackageSource - Provider nuget - Name $TempNuGetSourceName - Location $Global :PSGallerySourceUri - Trusted
1384+ Register-PackageSource - Provider nuget - Name $TempNuGetSourceName - Location $Global :PSGallerySourceUri - Trusted
13631385 try
13641386 {
13651387 Install-Module - Name $ModuleName - Repository $RepositoryName
@@ -1385,7 +1407,7 @@ Describe PowerShell.PSGet.InstallModuleTests.P1 -Tags 'P1','OuterLoop' {
13851407 finally
13861408 {
13871409 Unregister-PackageSource - ProviderName NuGet - Name $TempNuGetSourceName - Force
1388- }
1410+ }
13891411 }
13901412
13911413 # Purpose: Validate Save-Module cmdlet with Find-Command cmdlet output
@@ -1416,7 +1438,7 @@ Describe PowerShell.PSGet.InstallModuleTests.P1 -Tags 'P1','OuterLoop' {
14161438}
14171439
14181440Describe PowerShell.PSGet.InstallModuleTests.P2 - Tags ' P2' , ' OuterLoop' {
1419- # Not executing these tests on MacOS as
1441+ # Not executing these tests on MacOS as
14201442 # the total execution time is exceeding allowed 50 min in TravisCI daily builds.
14211443 if ($IsMacOS ) {
14221444 return
0 commit comments