diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 index 5ea2f278bc..5ba2354635 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 @@ -175,7 +175,7 @@ Describe "Set-Location" -Tags "CI" { Set-Location .. $ExecutionContext.InvokeCommand.LocationChangedAction = { throw "Boom" } # Verify that the exception occurred - { Set-Location $location } | Should Throw "Boom" + { Set-Location $location } | Should -Throw "Boom" # But the location should still have changed $PWD.Path | Should -Be $location.Path }