diff --git a/test/packaging/windows/msi.tests.ps1 b/test/packaging/windows/msi.tests.ps1 index b61153bf39..20b6c4f220 100644 --- a/test/packaging/windows/msi.tests.ps1 +++ b/test/packaging/windows/msi.tests.ps1 @@ -70,10 +70,10 @@ Describe -Name "Windows MSI" -Fixture { $uploadedLog = $false } BeforeEach { - $Error.Clear() + $error.Clear() } AfterEach { - if ($Error.Count -ne 0 -and !$uploadedLog) { + if ($error.Count -ne 0 -and !$uploadedLog) { Copy-Item -Path $msiLog -Destination $env:temp -Force Write-Verbose "MSI log is at $env:temp\msilog.txt" -Verbose $uploadedLog = $true diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index a95f294682..1e60dac41d 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -88,7 +88,7 @@ Describe "ConsoleHost unit tests" -tags "Feature" { } AfterEach { - $Error.Clear() + $error.Clear() } It "Clear-Host does not injects data into PowerShell output stream" { diff --git a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 index 2ddf23804a..1687abf605 100644 --- a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 +++ b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 @@ -229,7 +229,7 @@ Describe 'Positive Parse Properties Tests' -Tags "CI" { '111' -Match '1' $Matches $Matches - $Error[0] + $error[0] $error $pwd foreach ($i in 1..10) {$foreach} diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/PSSessionConfiguration.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/PSSessionConfiguration.Tests.ps1 index 4559109e82..fde3abc7e8 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/PSSessionConfiguration.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/PSSessionConfiguration.Tests.ps1 @@ -255,7 +255,7 @@ try It "$Description" { $Result = [PSObject] @{Output = $true ; Error = $null} - $Error.Clear() + $error.Clear() try { $null = Unregister-PSSessionConfiguration -name $SessionConfigName -ErrorAction stop diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 index dc8fc2bd8d..b97012d6fb 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 @@ -104,7 +104,7 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { It "Verify Rename-Item will not rename to an existing name" { { Rename-Item -Path $testFile -NewName $testDir -ErrorAction Stop } | Should -Throw -ErrorId "RenameItemIOError,Microsoft.PowerShell.Commands.RenameItemCommand" - $Error[0].Exception | Should -BeOfType System.IO.IOException + $error[0].Exception | Should -BeOfType System.IO.IOException $testFile | Should -Exist } @@ -133,7 +133,7 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { It "Verify Move-Item will not move to an existing file" { { Move-Item -Path $testDir -Destination $testFile -ErrorAction Stop } | Should -Throw -ErrorId "MoveDirectoryItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand" - $Error[0].Exception | Should -BeOfType System.IO.IOException + $error[0].Exception | Should -BeOfType System.IO.IOException $testDir | Should -Exist } @@ -748,8 +748,8 @@ Describe "Copy-Item can avoid copying an item onto itself" -Tags "CI", "RequireA else { { Copy-Item -Path $sourcePath -Destination $destinationPath -ErrorAction Stop } | Should -Throw -ErrorId "CopyError,Microsoft.PowerShell.Commands.CopyItemCommand" - $Error[0].Exception | Should -BeOfType System.IO.IOException - $Error[0].Exception.Data[$selfCopyKey] | Should -Not -BeNullOrEmpty + $error[0].Exception | Should -BeOfType System.IO.IOException + $error[0].Exception.Data[$selfCopyKey] | Should -Not -BeNullOrEmpty } } } @@ -811,8 +811,8 @@ Describe "Copy-Item can avoid copying an item onto itself" -Tags "CI", "RequireA ) { Copy-Item -Path $Source -Destination $Destination -ErrorAction Stop } | Should -Throw -ErrorId "CopyError,Microsoft.PowerShell.Commands.CopyItemCommand" - $Error[0].Exception | Should -BeOfType System.IO.IOException - $Error[0].Exception.Data[$selfCopyKey] | Should -Not -BeNullOrEmpty + $error[0].Exception | Should -BeOfType System.IO.IOException + $error[0].Exception.Data[$selfCopyKey] | Should -Not -BeNullOrEmpty } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 index b7e90b9383..5061c82a62 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 @@ -65,9 +65,9 @@ Describe "Test-Connection" -tags "CI" { Should -Throw -ErrorId "TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand" # Error code = 11001 - Host not found. if (!$isWindows) { - $Error[0].Exception.InnerException.ErrorCode | Should -Be -131073 + $error[0].Exception.InnerException.ErrorCode | Should -Be -131073 } else { - $Error[0].Exception.InnerException.ErrorCode | Should -Be 11001 + $error[0].Exception.InnerException.ErrorCode | Should -Be 11001 } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Error.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Error.Tests.ps1 index de3459c93b..e3cf51beef 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Error.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Error.Tests.ps1 @@ -2,7 +2,7 @@ # Licensed under the MIT License. Describe 'Get-Error tests' -Tag CI { - It 'Get-Error resolves $Error[0] and includes InnerException' { + It 'Get-Error resolves $error[0] and includes InnerException' { try { 1/0 } @@ -103,7 +103,7 @@ Describe 'Get-Error tests' -Tag CI { $null = Get-Error - $Error[0].pstypenames | Should -Be System.Management.Automation.ErrorRecord, System.Object + $error[0].pstypenames | Should -Be System.Management.Automation.ErrorRecord, System.Object } It 'Get-Error adds ExceptionType for Exceptions' { diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 index 8f61a92108..45973d431c 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 @@ -47,10 +47,10 @@ Describe "Stream writer tests" -Tags "CI" { } Context "Error automatic variable" { - It "Should write error messages to the `$Error automatic variable" { + It "Should write error messages to the `$error automatic variable" { Write-Error "Test Error Message" -ErrorAction SilentlyContinue - $Error[0] | Should -Match "Test Error Message" + $error[0] | Should -Match "Test Error Message" } }