chore: bump version to 17.3.7

Retry: deflaked tui IME preedit border test (#5563) — VirtualTerminal.waitForRender's fixed 40ms sleep raced TUI's throttled render timer on starved CI runners, reading the pre-input frame; waitForRender now takes an optional settle predicate polled up to 2s and the test keys on the rendered content.
This commit is contained in:
can1357
2026-08-18 11:24:23 +03:00
parent 644ad30d6e
commit adfa211bbf
2 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -1025,7 +1025,7 @@ describe("Editor component", () => {
await terminal.waitForRender();
for (const char of "ast") editor.handleInput(char);
tui.requestRender();
await terminal.waitForRender();
await terminal.waitForRender(() => terminal.getViewport()[1]?.includes("ast") === true);
const beforePreedit = terminal.getViewport().map(row => row.trimEnd());
expect(beforePreedit.slice(0, 3)).toEqual(["+------------------+", "| ast", "+------------------+"]);
+11 -2
View File
@@ -280,12 +280,21 @@ export class VirtualTerminal implements Terminal {
// --- Test-only helpers ---------------------------------------------------
/** Wait for TUI's throttled render pipeline to settle (matches the ~33ms frame budget). */
async waitForRender(): Promise<void> {
/**
* Wait for TUI's throttled render pipeline to settle (matches the ~33ms
* frame budget). Fixed sleeps race starved CI timers, so callers asserting
* on a specific frame pass `until`; polling continues (10ms slices, ~2s
* cap) until the predicate observes the expected viewport.
*/
async waitForRender(until?: () => boolean): Promise<void> {
const nextTick = Promise.withResolvers<void>();
process.nextTick(nextTick.resolve);
await nextTick.promise;
await Bun.sleep(40);
if (until) {
const deadline = Date.now() + 2_000;
while (!until() && Date.now() < deadline) await Bun.sleep(10);
}
await this.flush();
}