You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a user has TestMain and invokes m.Run() they'll eventually get back an exit code, which normally gets fed to os.Exit().
tparse returns an exit code that's inline with what m.Run() would return based on parsing the test output.
However, there is an edge case where m.Run() can return 0, but the user has additional logic that manually marks the exit code as >0, and then calls os.Exit()
Since tparse operates on the go test output, and doesn't know about this "extra" logic, it can report something different than expected.
The text was updated successfully, but these errors were encountered:
mfridman
changed the title
Handling exit code modifications after m.Run()
Handling custom exit code in TestMain after m.Run()
Dec 15, 2019
The most sane thing to do here is what was suggested in #54
set -o pipefail && go test ./... -json | tparse -all
Although tparse makes every effort to parse the output and return a non-zero status code, pipefail is your friend:
The exit status of a pipeline is the exit status of the last command in the pipeline, unless the pipefail option is enabled. If pipefail is enabled, the pipeline’s return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully. [...]
If a user has
TestMain
and invokesm.Run()
they'll eventually get back an exit code, which normally gets fed toos.Exit()
.tparse
returns an exit code that's inline with whatm.Run()
would return based on parsing the test output.However, there is an edge case where
m.Run()
can return 0, but the user has additional logic that manually marks the exit code as >0, and then callsos.Exit()
Since
tparse
operates on the go test output, and doesn't know about this "extra" logic, it can report something different than expected.The text was updated successfully, but these errors were encountered: