Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,16 @@ if summary.HasFailures() {

That shape works well in ordinary Go CLIs, Mage targets, Cobra/Fang commands, and small Go helpers invoked from tools like `make`, `just`, or `task`. `laslig` stays responsible for rendering, while the caller stays responsible for process control. Callers can also disable grouped failed-test, skipped-test, package-error, or captured-output sections when they want a tighter stream.

`gotestout` also supports one spinner-only live activity footer for active test
streams. The footer defaults to `auto`, which means styled human terminal
output gets one transient spinner line while the stream is active, while plain,
unstyled human, and JSON output stay stable and non-transient. Callers can
force that footer on with `gotestout.ActivityOn` for demos or disable it
entirely with `gotestout.ActivityOff`.

This repository dogfoods that pattern in [`magefiles/magefile.go`](./magefiles/magefile.go): `mage test` runs `go test -json ./...`, renders compact package and failure output through `gotestout`, and still returns a normal Mage error on failure.
The focused runnable example for that package lives in [`examples/gotestout/main.go`](./examples/gotestout/main.go).
The separate Mage-facing example in [`examples/magecheck/main.go`](./examples/magecheck/main.go) now also shows the recommended spinner handoff: keep one transient progress line alive while the command is quiet, then stop it before `gotestout` starts streaming package results.
The separate Mage-facing example in [`examples/magecheck/main.go`](./examples/magecheck/main.go) shows the same passing task-runner path with `gotestout`'s live activity footer enabled while the test stream is active.

Common ways to try that surface locally:

Expand All @@ -321,9 +328,9 @@ mage test

The focused `gotestout` GIF and example command intentionally include passing,
skipped, and failing test events plus one package build failure. The separate
`magecheck` GIF shows the passing task-runner path plus the spinner-to-stream
handoff before the live package output begins. That keeps the README honest
about both the success path and the failure path.
`magecheck` GIF shows the passing task-runner path with the live activity
footer active during the running stream. That keeps the README honest about
both the success path and the failure path.

Future `gotestout` work is about smarter summaries, not basic
functionality: clearer buckets for test failures vs package/build failures,
Expand All @@ -350,7 +357,7 @@ go run ./examples/all --format human --style always
mage test
```

`mage demo` is the normal paced walkthrough entrypoint. `mage test` is the real Mage-facing `gotestout` dogfood path. The `magecheck` focused example demonstrates the recommended spinner handoff before the live test stream. The `go run` forms above show the focused per-item examples directly, while `go run ./examples/all` renders the aggregate example without the paced demo wrapper.
`mage demo` is the normal paced walkthrough entrypoint. `mage test` is the real Mage-facing `gotestout` dogfood path. The `magecheck` focused example demonstrates the live activity footer during the running test stream. The `go run` forms above show the focused per-item examples directly, while `go run ./examples/all` renders the aggregate example without the paced demo wrapper.

The README GIFs are generated from the focused VHS tapes under [`docs/vhs/`](./docs/vhs). `mage vhs` renders all tracked tapes so the README stays aligned with the runnable examples.

Expand Down
3 changes: 2 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
//
// A specialist gotestout package provides structured rendering for go test
// -json streams in Mage targets, ordinary Go CLI commands, and small Go
// helpers invoked from tools such as make or just.
// helpers invoked from tools such as make or just, including an optional live
// spinner footer for styled human terminals while a test stream is active.
package laslig
Binary file modified docs/vhs/codeblock.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/gotestout.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/kv.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/list.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/logblock.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/magecheck.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/markdown.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/notice.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/panel.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/paragraph.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/record.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/section.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/spinner.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/statusline.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vhs/table.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions examples/all/testdata/TestRunArgsHumanStyledGolden.golden
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ gotestout

Use gotestout for attractive, structured go test output when your task runner, CLI command, or Go helper behind make/just should keep owning process control.

This focused example intentionally mixes passing, skipped, and failing test events plus one package build failure.
This focused example intentionally mixes passing, skipped, and failing test events plus one package build failure, and styled human terminals show gotestout's live activity footer while the stream is still active.

INFO Mixed fixture demo
The example command itself is expected to exit successfully so you can inspect the output shape.
Expand Down Expand Up @@ -217,7 +217,7 @@ gotestout + Mage

Use gotestout inside Mage or small Go helpers behind make, just, or task when you want caller-owned process control with a readable test stream.

The preview below matches this repository's mage check and mage test shape, including the recommended spinner handoff before the live test stream starts.
The preview below matches this repository's mage check and mage test shape, including the live gotestout activity footer while the test stream is still active.


Build
Expand All @@ -226,11 +226,10 @@ Build

SUCCESS Built example packages (./examples/...)

[RUNNING] Waiting for first test event
[SUCCESS] Test stream detected


Tests

INFO Started go test -json (./...)
PKG PASS github.com/evanmschultz/laslig (0.00s)
PKG PASS github.com/evanmschultz/laslig/examples/all (0.00s)
PKG PASS github.com/evanmschultz/laslig/examples/codeblock (0.00s)
Expand Down Expand Up @@ -268,6 +267,7 @@ Test summary
SUCCESS All tests passed
178 tests passed across 23 packages.


Coverage

╭──────────────────────────────────────────────────────────────────╮
Expand Down
10 changes: 5 additions & 5 deletions examples/all/testdata/TestRunArgsPlainGolden.golden
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ gotestout

Use gotestout for attractive, structured go test output when your task runner, CLI command, or Go helper behind make/just should keep owning process control.

This focused example intentionally mixes passing, skipped, and failing test events plus one package build failure.
This focused example intentionally mixes passing, skipped, and failing test events plus one package build failure, and styled human terminals show gotestout's live activity footer while the stream is still active.

[INFO] Mixed fixture demo
The example command itself is expected to exit successfully so you can inspect the output shape.
Expand Down Expand Up @@ -202,7 +202,7 @@ gotestout + Mage

Use gotestout inside Mage or small Go helpers behind make, just, or task when you want caller-owned process control with a readable test stream.

The preview below matches this repository's mage check and mage test shape, including the recommended spinner handoff before the live test stream starts.
The preview below matches this repository's mage check and mage test shape, including the live gotestout activity footer while the test stream is still active.


Build
Expand All @@ -211,11 +211,10 @@ Build

[SUCCESS] Built example packages (./examples/...)

[RUNNING] Waiting for first test event
[SUCCESS] Test stream detected


Tests

[INFO] Started go test -json (./...)
[PKG PASS] github.com/evanmschultz/laslig (0.00s)
[PKG PASS] github.com/evanmschultz/laslig/examples/all (0.00s)
[PKG PASS] github.com/evanmschultz/laslig/examples/codeblock (0.00s)
Expand Down Expand Up @@ -253,6 +252,7 @@ Test summary
[SUCCESS] All tests passed
178 tests passed across 23 packages.


Coverage

package | cover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ gotestout

Use gotestout for attractive, structured go test output when your task runner, CLI command, or Go helper behind make/just should keep owning process control.

This focused example intentionally mixes passing, skipped, and failing test events plus one package build failure.
This focused example intentionally mixes passing, skipped, and failing test events plus one package build failure, and styled human terminals show gotestout's live activity footer while the stream is still active.

[INFO] Mixed fixture demo
The example command itself is expected to exit successfully so you can inspect the output shape.
Expand Down
6 changes: 3 additions & 3 deletions examples/magecheck/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import (
)

func TestRunArgsPlain(t *testing.T) {
exampletestutil.AssertRunArgsPlainContains(t, runArgs, "gotestout + Mage", "[RUNNING] Waiting for first test event", "[SUCCESS] Test stream detected", "Coverage threshold met")
exampletestutil.AssertRunArgsPlainContains(t, runArgs, "gotestout + Mage", "[INFO] Started go test -json (./...)", "Coverage threshold met")
}

func TestRunArgsHumanStyled(t *testing.T) {
exampletestutil.AssertRunArgsHumanStyled(t, runArgs, "Waiting for first test event", "Test stream detected", "All tests passed")
exampletestutil.AssertRunArgsHumanStyled(t, runArgs, "Started go test -json", "All tests passed")
}

func TestRunArgsInvalidFlag(t *testing.T) {
exampletestutil.AssertRunArgsInvalidFlag(t, runArgs)
}

func TestMain(t *testing.T) {
exampletestutil.AssertMainContains(t, main, "magecheck-example", "Test stream detected", "Coverage threshold met")
exampletestutil.AssertMainContains(t, main, "magecheck-example", "Started go test -json", "Coverage threshold met")
}
Loading