Skip to content

Commit 17bf497

Browse files
committed
test(testing): raise waitForText poll default 5000->10000ms to de-flake render tests
The vitest gate flaked a 2nd time — screenshot.test.ts "preserves 256-color codes" timed out after 5000ms waiting for ORANGE. #116 raised VITEST's testTimeout (15000ms), but the real 5000ms is waitForText's OWN internal poll timeout (src/testing/session.ts), which #116 never touched — so terminal render under CI load still tripped it. Raise the waitForText/waitForAbsent/waitFor default to 10000ms, matching the explicit 10000-15000ms render-heavy tests already pass (scrollback-fidelity.test.ts) and staying under screenshot's 15000ms vitest testTimeout. Only affects failure/slow-wait latency; a matching wait returns immediately. Folded into this PR so it fixes BOTH required-gate flakes (parity teardown ENOTEMPTY + screenshot render timeout) and one CI run validates both.
1 parent 55a6d0a commit 17bf497

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/testing/session.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,17 @@ export class Session {
287287

288288
// ── Waiting ──
289289

290+
// Default poll-wait budget. Terminal render under CI load routinely exceeds
291+
// the old 5000ms — it caused two screenshot render flakes (true-color, then
292+
// 256-color) that false-red the required vitest gate. 10000ms matches the
293+
// explicit timeouts render-heavy tests already pass (see
294+
// scrollback-fidelity.test.ts) and stays under screenshot.test.ts's 15000ms
295+
// vitest testTimeout, so a slow wait fails HERE with the useful "waiting for
296+
// X" message rather than as a blunt vitest test-timeout. Only affects
297+
// failure/slow-wait latency; a wait that matches returns immediately.
298+
290299
/** Poll until the terminal contains the given text. Returns the matching screenshot. */
291-
async waitForText(text: string, timeoutMs = 5000): Promise<Screenshot> {
300+
async waitForText(text: string, timeoutMs = 10000): Promise<Screenshot> {
292301
const start = Date.now();
293302
while (Date.now() - start < timeoutMs) {
294303
await new Promise((r) => setTimeout(r, 50));
@@ -302,7 +311,7 @@ export class Session {
302311
}
303312

304313
/** Poll until the terminal no longer contains the given text. */
305-
async waitForAbsent(text: string, timeoutMs = 5000): Promise<Screenshot> {
314+
async waitForAbsent(text: string, timeoutMs = 10000): Promise<Screenshot> {
306315
const start = Date.now();
307316
while (Date.now() - start < timeoutMs) {
308317
await new Promise((r) => setTimeout(r, 50));
@@ -318,7 +327,7 @@ export class Session {
318327
/** Poll until a custom predicate returns true. The `description` is used in timeout error messages. */
319328
async waitFor(
320329
predicate: (ss: Screenshot) => boolean,
321-
timeoutMs = 5000,
330+
timeoutMs = 10000,
322331
description = "predicate"
323332
): Promise<Screenshot> {
324333
const start = Date.now();

0 commit comments

Comments
 (0)