It can be useful to let the user run the test command(s) itself, for example when complex shell scripts are involved which need to invoke go test multiple times.
With -stdin, the go test stdout is expected on stdin of gotestsum, so it can be used in a pipe. To detect abnormal termination of the test commands, bash with "set -o pipefail" should be used. Beware that such failures are not detected by gotestsum.
To also capture stderr with gotestsum, stderr must get redirected like this:
mkfifo /tmp/pipe
go test ... 2>/tmp/pipe | gotestsum -stdin -stderr 3 3</tmp/pipe
It can be useful to let the user run the test command(s) itself, for example when complex shell scripts are involved which need to invoke
go test
multiple times.With -stdin, the
go test
stdout is expected on stdin of gotestsum, so it can be used in a pipe. To detect abnormal termination of the test commands, bash with "set -o pipefail" should be used. Beware that such failures are not detected by gotestsum.To also capture stderr with gotestsum, stderr must get redirected like this:
Fixes: https://github.com/gotestyourself/gotestsum/issues/414