From ebe66df248f58ed8c94586ca1336dd12570f18d7 Mon Sep 17 00:00:00 2001 From: Nathan Herald Date: Fri, 31 Jul 2026 20:47:04 +0200 Subject: [PATCH 1/2] Wait for alternate screen exit in screenshot test --- tests/screenshot.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/screenshot.test.ts b/tests/screenshot.test.ts index 9f3625c..4db3cdd 100644 --- a/tests/screenshot.test.ts +++ b/tests/screenshot.test.ts @@ -710,11 +710,13 @@ describe("screenshot: alternate screen buffer", () => { "printf 'alt-screen-only';" + "sleep 0.3;" + "printf '\\033[?1049l';" + + "echo 'main-buffer-restored';" + "sleep 30", ]); - const ss = await session.waitForText("main-buffer-text"); + const ss = await session.waitForText("main-buffer-restored"); expect(ss.text).toContain("main-buffer-text"); + expect(ss.text).toContain("main-buffer-restored"); // Alt screen content should NOT appear in the main buffer expect(ss.text).not.toContain("alt-screen-only"); }); From 8a66992a59fea6eceddd874218d329c8a6dab7e7 Mon Sep 17 00:00:00 2001 From: Nathan Herald Date: Fri, 31 Jul 2026 20:48:10 +0200 Subject: [PATCH 2/2] Await nested daemon teardown in tests --- tests/nesting.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/nesting.test.ts b/tests/nesting.test.ts index a6801c6..15d6430 100644 --- a/tests/nesting.test.ts +++ b/tests/nesting.test.ts @@ -169,8 +169,9 @@ describe("pty nesting prevention", () => { expect(found).toBeDefined(); expect(found.status).toBe("running"); - // Clean up the daemon - try { process.kill(found.pid, "SIGTERM"); } catch {} + // Let the awaited teardown barrier stop this detached daemon before the + // suite removes its session root. + bgPids.push(found.pid); }, 15000); it("propagates exit code from nested command", () => { @@ -207,7 +208,8 @@ describe("pty nesting prevention", () => { const found = sessions.find((s: any) => s.name === name); expect(found).toBeDefined(); - // Clean up the daemon - try { process.kill(found.pid, "SIGTERM"); } catch {} + // Let the awaited teardown barrier stop this detached daemon before the + // suite removes its session root. + bgPids.push(found.pid); }, 15000); });