fix stopiffails switch logic. suppress error output
This commit is contained in:
parent
e50acbcfbe
commit
f33a243191
@ -83,7 +83,7 @@ Could not find the required {0} called {1}. Please install the required {0} to r
|
||||
}
|
||||
|
||||
'PSSnapin' {
|
||||
if (Get-PSSnapin -Name $Name -Registered) {
|
||||
if (Get-PSSnapin -Name $Name -Registered -ErrorAction SilentlyContinue) {
|
||||
return $true
|
||||
}
|
||||
else {
|
||||
|
@ -43,7 +43,7 @@ Describe "Test-ModuleName" {
|
||||
Test-Module -Name 'foobar2000' -Type PSSnapin | Should -Be $false
|
||||
}
|
||||
It "StopifFails switch should thrown an error" {
|
||||
{Test-Module -Name 'foobar2000' -Type PSSnapin }| Should -Throw
|
||||
{Test-Module -Name 'foobar2000' -Type PSSnapin -StopIfFails }| Should -Throw
|
||||
}
|
||||
}
|
||||
Context "Working with modules" {
|
||||
@ -59,7 +59,7 @@ Describe "Test-ModuleName" {
|
||||
Test-Module -Name 'foobar2000' -Type Module | Should -Be $false
|
||||
}
|
||||
It "StopifFails switch should thrown an error" {
|
||||
{Test-Module -Name 'foobar2000' -Type Module }| Should -Throw
|
||||
{Test-Module -Name 'foobar2000' -Type Module -StopIfFails }| Should -Throw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user