Move Set-StrictMode to outer scriptblock for ErrorView (#11381)

This commit is contained in:
Steve Lee authored and Ilya committed 2019-12-17 23:43:47 +05:00
1 parent 04cf068878
commit edd3e7680c
2 files changed
+20 -1

No files matched your search

@@ -63,4 +63,23 @@ Describe 'Tests for $ErrorView' -Tag CI {
$e | Out-String | Should -Not -BeLike '*pester*'
}
}
Context 'NormalView tests' {
It 'Error shows up when using strict mode' {
try {
$ErrorView = 'NormalView'
Set-StrictMode -Version 2
throw 'Oops!'
}
catch {
$e = $_ | Out-String
}
finally {
Set-StrictMode -Off
}
$e | Should -BeLike '*Oops!*'
}
}
}