June 29, 2021 07:23 pm GMT
Original Link: https://dev.to/jonasbn/til-colorful-test-output-in-go-3k86
TIL: Colorful test output in Go
The standard command line use when testing go:
$ go test
Colors your test output according to your terminal configuration.
@rakyll has implemented a cool tool gotest
for coloring your test output, so you have passing tests colored green, failing tests marked red etc.
$ gotest
You can customize the colors for failing tests and passing tests via environment variables using the palette of your terminal.
GOTEST_PALETTE="red,green" gotest
The first color being for failures and the second one being for passes.
To find the colors in for example iTerm.app open the Preferences, your profile and the color tab.
Use the names for the colors in the environment variables
Resources and References
This article was lifted from my TIL collection
Original Link: https://dev.to/jonasbn/til-colorful-test-output-in-go-3k86
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To