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); }); 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"); });