mfridman/tparse

Minimize noisy output in `--follow`

Closed this issue · 0 comments

One of the goals of tparse was to reduce the amount of noise from go test output. However, there's a specific scenario that leads to too much verbose output in my opinion, specifically --follow:

go test fmt -json | tparse --follow

The -follow flag parses the incoming JSON lines and prints them wholesale. There is no pre-processing or filtering, it's effective a tee of the raw go test output which can be useful for debugging.

The problem is that -json (even when -v is not set) will include update, result and big pass/fail output:

=== RUN
=== PAUSE
=== CONT
=== PASS
=== SKIP

--- PASS:
--- SKIP:

PASS
FAIL

Example

$ go test fmt -json -count=1 | tparse -follow   
=== RUN   TestErrorf
--- PASS: TestErrorf (0.00s)
=== RUN   TestFmtInterface
--- PASS: TestFmtInterface (0.00s)
=== RUN   TestSprintf
--- PASS: TestSprintf (0.00s)
=== RUN   TestComplexFormatting
--- PASS: TestComplexFormatting (0.00s)
=== RUN   TestReorder
--- PASS: TestReorder (0.00s)
=== RUN   TestCountMallocs
    fmt_test.go:1457: skipping; GOMAXPROCS>1
--- SKIP: TestCountMallocs (0.00s)
=== RUN   TestFlagParser
[...]
PASS
ok  	fmt	0.143s

So, I propose we modify the behavior to ignore these statements by default. Now, this could be considered a breaking change, and if someone finds this limiting (I'd love to first understand why you'd need this output) then we can add a flag like --follow-verbose to at least enable this behavior back.

I suspect most users won't notice, but if it does, please don't hesitate to open an issue.

Expected

$ go test fmt -json -count=1 | tparse -follow   
    fmt_test.go:1457: skipping; GOMAXPROCS>1
ok  	fmt	0.143s