@@ -64,13 +64,16 @@ func standardJSONFormat(out io.Writer) EventFormatter {
64
64
})
65
65
}
66
66
67
- func testNameFormat (out io.Writer ) EventFormatter {
67
+ func testNameFormat (out io.Writer , opts FormatOptions ) EventFormatter {
68
68
buf := bufio .NewWriter (out )
69
69
// nolint:errcheck
70
70
return eventFormatterFunc (func (event TestEvent , exec * Execution ) error {
71
71
formatTest := func () error {
72
72
pkgPath := RelativePackagePath (event .Package )
73
73
74
+ if opts .OutputWallTime {
75
+ buf .WriteString (fmtElapsed (exec .Elapsed (), false )) // nolint:errcheck
76
+ }
74
77
fmt .Fprintf (buf , "%s %s%s %s\n " ,
75
78
colorEvent (event )(strings .ToUpper (string (event .Action ))),
76
79
joinPkgToTestName (pkgPath , event .Test ),
@@ -95,6 +98,9 @@ func testNameFormat(out io.Writer) EventFormatter {
95
98
result = colorEvent (event )("EMPTY" )
96
99
}
97
100
101
+ if opts .OutputWallTime {
102
+ buf .WriteString (fmtElapsed (exec .Elapsed (), false )) // nolint:errcheck
103
+ }
98
104
event .Elapsed = 0 // hide elapsed for now, for backwards compat
99
105
buf .WriteString (result )
100
106
buf .WriteRune (' ' )
@@ -293,7 +299,7 @@ func NewEventFormatter(out io.Writer, format string, formatOpts FormatOptions) E
293
299
case "dots-v2" :
294
300
return newDotFormatter (out , formatOpts )
295
301
case "testname" , "short-verbose" :
296
- return testNameFormat (out )
302
+ return testNameFormat (out , formatOpts )
297
303
case "pkgname" , "short" :
298
304
return pkgNameFormat (out , formatOpts )
299
305
case "pkgname-and-test-fails" , "short-with-failures" :
0 commit comments