Skip to content

Commit 8fdd68f

Browse files
SteveL-MSFTadityapatwardhan
authored andcommitted
[feature] (PowerShell#4954)
remove unnecessary error messages from output
1 parent 757c6b5 commit 8fdd68f

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

test/powershell/Modules/Microsoft.PowerShell.Utility/Export-Alias.Tests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Describe "Export-Alias DRT Unit Tests" -Tags "CI" {
55
$testAliases = "TestAliases"
66
$fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases
77

8-
remove-item alias:abcd* -force
9-
remove-item alias:ijkl* -force
8+
remove-item alias:abcd* -force -ErrorAction SilentlyContinue
9+
remove-item alias:ijkl* -force -ErrorAction SilentlyContinue
1010
set-alias abcd01 efgh01
1111
set-alias abcd02 efgh02
1212
set-alias abcd03 efgh03
@@ -18,8 +18,8 @@ Describe "Export-Alias DRT Unit Tests" -Tags "CI" {
1818
}
1919

2020
AfterAll {
21-
remove-item alias:abcd* -force
22-
remove-item alias:ijkl* -force
21+
remove-item alias:abcd* -force -ErrorAction SilentlyContinue
22+
remove-item alias:ijkl* -force -ErrorAction SilentlyContinue
2323
}
2424

2525
BeforeEach {

test/powershell/Modules/Microsoft.PowerShell.Utility/Import-Alias.Tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Describe "Import-Alias DRT Unit Tests" -Tags "CI" {
55

66
BeforeEach {
77
New-Item -Path $testAliasDirectory -ItemType Directory -Force
8-
remove-item alias:abcd* -force
9-
remove-item alias:ijkl* -force
8+
remove-item alias:abcd* -force -ErrorAction SilentlyContinue
9+
remove-item alias:ijkl* -force -ErrorAction SilentlyContinue
1010
set-alias abcd01 efgh01
1111
set-alias abcd02 efgh02
1212
set-alias abcd03 efgh03
@@ -18,7 +18,7 @@ Describe "Import-Alias DRT Unit Tests" -Tags "CI" {
1818
}
1919

2020
AfterEach {
21-
Remove-Item -Path $testAliasDirectory -Recurse -Force
21+
Remove-Item -Path $testAliasDirectory -Recurse -Force -ErrorAction SilentlyContinue
2222
}
2323

2424
It "Import-Alias Resolve To Multiple will throw PSInvalidOperationException" {

test/powershell/engine/Help/HelpSystem.Tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Describe "Get-Help should find help info within help files" -Tags @('CI', 'Requi
219219
{
220220
$null = New-Item -ItemType Directory -Path $helpFolderPath -ErrorAction SilentlyContinue
221221
}
222-
222+
223223
try
224224
{
225225
$null = New-Item -ItemType File -Path $helpFilePath -Value "about_test" -ErrorAction SilentlyContinue
@@ -234,11 +234,11 @@ Describe "Get-Help should find help info within help files" -Tags @('CI', 'Requi
234234
}
235235

236236
Describe "Get-Help should find pattern help files" -Tags "CI" {
237-
238-
# There is a bug specific to Travis CI that hangs the test if "get-help" is used to search pattern string. This doesn't repro locally.
237+
238+
# There is a bug specific to Travis CI that hangs the test if "get-help" is used to search pattern string. This doesn't repro locally.
239239
# This occurs even if Unix system just returns "Directory.GetFiles(path, pattern);" as the windows' code does.
240240
# Since there's currently no way to get the vm from Travis CI and the test PASSES locally on both Ubuntu and MacOS, excluding pattern test under Unix system.
241-
241+
242242
BeforeAll {
243243
$helpFile1 = "about_testCase1.help.txt"
244244
$helpFile2 = "about_testCase.2.help.txt"
@@ -249,7 +249,7 @@ Describe "Get-Help should find pattern help files" -Tags "CI" {
249249
$null = New-Item -ItemType Directory -Path $helpFolderPath -ErrorAction SilentlyContinue -Force
250250
# Create at least one help file matches "about*" pattern
251251
$null = New-Item -ItemType File -Path $helpFilePath1 -Value "about_test1" -ErrorAction SilentlyContinue
252-
$null = New-Item -ItemType File -Path $helpFilePath2 -Value "about_test2" -ErrorAction SilentlyContinue
252+
$null = New-Item -ItemType File -Path $helpFilePath2 -Value "about_test2" -ErrorAction SilentlyContinue
253253
}
254254

255255
# Remove the test files
@@ -277,9 +277,9 @@ Describe "Get-Help should find pattern help files" -Tags "CI" {
277277
Describe "Get-Help should find pattern alias" -Tags "CI" {
278278
# Remove test alias
279279
AfterAll {
280-
Remove-Item alias:\testAlias1
280+
Remove-Item alias:\testAlias1 -ErrorAction SilentlyContinue
281281
}
282-
282+
283283
It "Get-Help should find alias as command" {
284284
(Get-Help where).Name | Should BeExactly "Where-Object"
285285
}

0 commit comments

Comments
 (0)