Skip to content

testing: colorize output on failing tests #46921

@wymli

Description

@wymli

What version of Go are you using (go version)?

$ go version
go version go1.16.2 windows/amd64

Proposal

Can we have color print when unit test case fail?

What did you expect to see?

Maybe we can have color print when unit test pass or fail, we can make a switch in pkg testing like t.RedErrorf(...)or cmd go test like go test ./... --color

What did you see instead?

When we have many test cases, and normally we will add -v to debug, it's hard to find the failed case.
Because we have many test flags,likego test $(go list ./... | grep -v "/neverTest") -coverprofile=cover.out -covermode=conut -gcflags=all=-l -v, the go test cmd will be placed in a unit_test.sh typically.
We won't change the script, keeping -v, which will bring many debug messages, resulting in the fact that it's hard for us to find which case failed.

By the way, do we have some better ways to only test some dirs, or exclude some dirs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions