Files
callstack__agent-device/test/integration/cli-json.ts
Michał Pierzchała 4e4ecdea0d test(ios): expand simulator e2e coverage (#1408)
* test(ios): expand simulator e2e coverage

* test(ios): make coverage checks host portable

* test(ios): handle deep link confirmation

* test(ios): fix deep link prompt selector

* ci: stabilize full simulator nightly

* test(ios): stabilize permission prompt lifecycle

* test(e2e): wait for route-specific landmarks

* test(e2e): reset permissions from inactive app

* test(e2e): redeliver trusted cold deep links

* test(ios): verify orientation native readback

* test(ios): stabilize simulator permission coverage

* test(ios): wait for tab target after deep link

* test(ios): paginate full event timeline

* test(ios): simplify event pagination coverage

* test(ios): stabilize simulator e2e coverage

* test(ios): model simulator recorder lifetime

* ci(test-app): cache fixture dependencies

* fix(ci): isolate test app cache by node

* fix(ios): settle fixture route navigation

* test(ci): waive unbenchmarked ios system UI help

* fix(ios): tolerate delayed simulator scale lookup

* 0.20.1

* test(ci): remove superseded system UI waiver

* fix(ios): harden simulator e2e reliability

* chore: clarify Apple runner CI steps

* fix(ios): wait before fixture home snapshot

* fix(ios): require exact catalog navigation

* chore(ci): format rebased workflows

* fix(ios): retry unobserved fixture navigation

* refactor(test): remove iOS e2e workarounds

* fix(ci): verify fixture artifact provenance

* fix(ci): align fixture artifact fingerprints

* fix(ci): use unified Android helper packager

* perf(ci): scope fixture build concurrency

* chore: format fixture artifact tests

* test(ios): update split Apple coverage owner

* fix(ios): accept deep-link confirmation alerts
2026-07-28 20:08:45 +02:00

71 lines
1.7 KiB
TypeScript

import { runCmd, runCmdSync, type ExecResult } from '../../src/utils/exec.ts';
const CLI_TIMEOUT_MS = 120_000;
export type CliJsonResult = {
status: number;
json?: any;
stdout: string;
stderr: string;
};
export function runSourceCliJsonSync(
args: string[],
options?: { env?: NodeJS.ProcessEnv },
): CliJsonResult {
const result = runCmdSync(
process.execPath,
['--experimental-strip-types', 'src/bin.ts', ...args],
{
allowFailure: true,
env: options?.env,
timeoutMs: CLI_TIMEOUT_MS,
},
);
return cliJsonResult(result);
}
export async function runBuiltCliJson(
args: string[],
env: NodeJS.ProcessEnv,
options?: { timeoutMs?: number },
): Promise<CliJsonResult> {
const result = await runCmd(process.execPath, ['bin/agent-device.mjs', ...args], {
allowFailure: true,
env,
timeoutMs: options?.timeoutMs ?? CLI_TIMEOUT_MS,
});
return cliJsonResult(result);
}
export function formatResultDebug(step: string, args: string[], result: CliJsonResult): string {
const jsonText =
result.json === undefined ? '(unparseable)' : JSON.stringify(result.json, null, 2);
return [
`step: ${step}`,
`command: agent-device ${args.join(' ')}`,
`status: ${result.status}`,
`stderr:`,
result.stderr || '(empty)',
`stdout:`,
result.stdout || '(empty)',
`json:`,
jsonText,
].join('\n');
}
function cliJsonResult(result: ExecResult): CliJsonResult {
let json: any;
try {
json = JSON.parse(result.stdout ?? '');
} catch {
json = undefined;
}
return {
status: result.exitCode,
json,
stdout: json ? '<JSON output>' : (result.stdout ?? ''),
stderr: result.stderr ?? '',
};
}