gotestyourself / gotestsum

'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.
Apache License 2.0
2.03k stars 119 forks source link

WIP: dotsv2: improvements to reduce text jitteriness #353

Closed howardjohn closed 11 months ago

howardjohn commented 1 year ago

For https://github.com/gotestyourself/gotestsum/issues/352

I don't think this is fully ready but its mostly usable as a POC.

Basically the jitteriness comes from two causes:

  1. Unlimited height. If we have 1000 packages, for example, and 50 line terminal then we are still trying to write all 1000 packages. This makes it hard for the terminal emulator to keep up
  2. Fast writes. We write every time an event comes in, which can be very very often. Like 1000s per second. Again, we cannot keep up.

This PR fixes this by only including the last <height> lines (determined from inspecting the terminal) and writing updates on a 100ms timer instead of fixed.

This is inspired by https://github.com/docker/compose/blob/80856eacafcf96d6f27e74c07e42386fe662f8ef/pkg/progress/tty.go#L50 which has, IMO, a pretty nice progress UI. Note they don't do the height part.

Some things I think would make this better/acceptable to merge:

Opening for early feedback

dnephin commented 11 months ago

I assume this was resolved by #368, but if not I'm happy to re-open.