Skip to content

Commit 25a3228

Browse files
SteveL-MSFTTravisEz13
authored andcommitted
fix tests not setting back $psdefaultparametervalues back correctly (PowerShell#4892)
1 parent 40577cb commit 25a3228

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

test/powershell/Language/Parser/RedirectionOperator.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ Describe "Redirection operator now supports encoding changes" -Tags "CI" {
1313
# If out-file -encoding happens to have a default, be sure to
1414
# save it away
1515
$SavedValue = $null
16-
$oldDefaultParameterValues = $psDefaultParameterValues
16+
$oldDefaultParameterValues = $psDefaultParameterValues.Clone()
1717
$psDefaultParameterValues = @{}
1818
}
1919
AfterAll {
2020
# be sure to tidy up afterwards
21-
$psDefaultParameterValues = $oldDefaultParameterValues
21+
$global:psDefaultParameterValues = $oldDefaultParameterValues
2222
}
2323
BeforeEach {
2424
# start each test with a clean plate!

test/powershell/Modules/Microsoft.PowerShell.Security/CertificateProvider.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Describe "Certificate Provider tests" -Tags "CI" {
3636
AfterAll {
3737
if(!$IsWindows)
3838
{
39-
$PSdefaultParameterValues = $defaultParamValues
39+
$global:PSdefaultParameterValues = $defaultParamValues
4040
}
4141
}
4242

@@ -98,7 +98,7 @@ Describe "Certificate Provider tests" -Tags "Feature" {
9898
}
9999
else
100100
{
101-
$PSdefaultParameterValues = $defaultParamValues
101+
$global:PSdefaultParameterValues = $defaultParamValues
102102
}
103103
}
104104

test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Describe "CmsMessage cmdlets thorough tests" -Tags "Feature" {
8181
}
8282
else
8383
{
84-
$PSdefaultParameterValues = $defaultParamValues
84+
$global:PSdefaultParameterValues = $defaultParamValues
8585
}
8686
}
8787

test/powershell/Modules/Microsoft.PowerShell.Security/SecureString.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Describe "SecureString conversion tests" -Tags "CI" {
88
if ( ! $IsWindows ) { $PSdefaultParameterValues["it:pending"] = $true }
99
}
1010
AfterAll {
11-
$PSdefaultParameterValues = $defaultParamValues
11+
$global:PSdefaultParameterValues = $defaultParamValues
1212
}
1313

1414
It "using null arguments to ConvertFrom-SecureString produces an exception" {

0 commit comments

Comments
 (0)