Skip to content

Commit

Permalink
Merge pull request #61 from nhooyr/better-short-verbose
Browse files Browse the repository at this point in the history
Improve short-verbose output for tests in CWD
  • Loading branch information
dnephin authored Aug 25, 2019
2 parents 31514b3 + aaabbb3 commit fc6cb58
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions testjson/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,20 @@ func standardQuietFormat(event TestEvent, _ *Execution) (string, error) {
func shortVerboseFormat(event TestEvent, exec *Execution) (string, error) {
result := colorEvent(event)(strings.ToUpper(string(event.Action)))
formatTest := func() string {
return fmt.Sprintf("%s %s.%s %s\n",
pkgPath := relativePackagePath(event.Package)
// If the package path isn't the current directory, we add
// a period to separate the test name and the package path.
// If it is the current directory, we don't show it at all.
// This prevents output like ..MyTest when the test
// is in the current directory.
if pkgPath == "." {
pkgPath = ""
} else {
pkgPath += "."
}
return fmt.Sprintf("%s %s%s %s\n",
result,
relativePackagePath(event.Package),
pkgPath,
event.Test,
event.ElapsedFormatted())
}
Expand Down

0 comments on commit fc6cb58

Please sign in to comment.