Files
paseo/packages/cli/tests/helpers/terminal.ts
Mohamed Boudra c8a417c4fb Address terminals by workspace ID in the SDK and CLI (#4358)
* feat(terminals): expose workspace ownership through the SDK and CLI

Directory-based terminal creation selected the oldest workspace sharing that path. Expose explicit workspace ownership in the shared public API and CLI, retain ownership and process directories in listings, and acknowledge terminal deletion after teardown.

* fix(file-observer): preserve nested shallow reconciliation scopes

A parent directory scan does not visit its descendants. Collapsing change scopes discarded nested scans and left coalesced native deletions unseen until a full audit.

* test(terminals): extract output waits from end-to-end scenarios
2026-09-06 10:17:58 +02:00

20 lines
770 B
TypeScript

import assert from "node:assert/strict";
import type { createE2ETestContext } from "./test-daemon.ts";
export async function waitForTerminalOutput(
paseo: Awaited<ReturnType<typeof createE2ETestContext>>["paseo"],
terminalId: string,
text: string,
): Promise<void> {
const deadline = Date.now() + 10_000;
let lines: string[] = [];
while (Date.now() < deadline) {
const result = await paseo(["terminal", "capture", terminalId, "--json"]);
assert.equal(result.exitCode, 0, result.stderr);
lines = JSON.parse(result.stdout).lines;
if (lines.some((line) => line.includes(text))) return;
await new Promise((resolve) => setTimeout(resolve, 25));
}
throw new Error(`Missing terminal output: ${text}\nLast capture:\n${lines.join("\n")}`);
}