Where is the correct place in a test to set ErrorActionPreference / StrictMode #2134
Unanswered
codykonior
asked this question in
Q&A
Replies: 1 comment
-
Yeah you are right, strict mode or error preference are not persisted, till the Run phase, if you don't have any code in BeforeDiscovery then just put it in your BeforeAll. I am working on making the global side effects more persistent. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I do all my testing with:
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
In v5 this was in the topmost level of the script, but in v5 we shouldn't have anything there.
I could put it in BeforeDiscovery but then it won't be set for the Run phase, will it?
I could set it in a top level BeforeAll, but I'm not sure if that runs before or after BeforeDiscovery. And whether I'd need it in both.
Beta Was this translation helpful? Give feedback.
All reactions