Skip to content

What's the difference between PesterConfiguration Exit, Throw, and the default? #2133

Answered by fflaten
codykonior asked this question in Q&A
Discussion options

You must be logged in to vote

Default is to print report to screen, set $LASTEXITCODE to number of failed tests (this is always done) and proceed with the script that called Invoke-Pester.

If any failed tests/blocks:

  • Run.Throw will make Pester throw an exception at the end with "x tests failed..." so you can wrap Invoke-Pester in try/catch.

  • Run.Exit will exit the process with number of failed tests as exitcode. Typically used to abort a CI-process.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nohwnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants