fix(tui): sync test awaits with throttled render pipeline (#3076)

Tests assumed renders complete synchronously after requestRender() +
nextTick + flush(), but commit 6f5f37f8 changed requestRender() to
schedule via setTimeout with a 16ms minimum interval. Tests reading
viewport state before doRender() runs saw stale data.

Add VirtualTerminal.waitForRender() helper that waits for the throttled
render to settle (nextTick + 20ms + xterm flush), and replace all
terminal.flush() calls after render-triggering actions with it.

Fixes 8 failing tests across overlay-short-content, tui-render, and
markdown test suites.
This commit is contained in:
Aliou Diallo
2026-04-13 10:57:48 +02:00
committed by GitHub
parent fb6ccbeaa1
commit 41377ee8ec
8 changed files with 50 additions and 43 deletions

View File

@@ -5,6 +5,7 @@
### Fixed
- Fixed `Container.render()` stack overflow on long sessions by replacing `Array.push(...spread)` with a loop-based push, preventing `RangeError: Maximum call stack size exceeded` when child output exceeds the V8 call stack argument limit ([#2651](https://github.com/badlogic/pi-mono/issues/2651))
- Fixed TUI test suite failures caused by render throttle scheduling: added `VirtualTerminal.waitForRender()` helper that waits for the 16ms throttled render pipeline to settle before asserting viewport state ([#3076](https://github.com/badlogic/pi-mono/pull/3076) by [@aliou](https://github.com/aliou))
## [0.66.1] - 2026-04-08