mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
a0ce6f1df2
* Refine reinstall flow and add agent-focused coverage * Avoid duplicate readiness preflight in open flow * Document boot and reinstall in website docs and skill * Bound iOS boot commands and enforce runCmd timeouts * Align boot readiness with timeout profiles across platforms * Refine boot docs: troubleshooting-only and non-CI wording * Clarify open vs boot fallback guidance
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { runCmdSync } from '../../src/utils/exec.ts';
|
|
|
|
function runCli(args: string[]): { status: number; stdout: string; stderr: string } {
|
|
const result = runCmdSync(
|
|
process.execPath,
|
|
['--experimental-strip-types', 'src/bin.ts', ...args],
|
|
{ allowFailure: true },
|
|
);
|
|
return { status: result.exitCode, stdout: result.stdout ?? '', stderr: result.stderr ?? '' };
|
|
}
|
|
|
|
test('cli --help returns usage', () => {
|
|
const result = runCli(['--help']);
|
|
assert.equal(result.status, 0, result.stderr);
|
|
assert.match(result.stdout, /agent-device/i);
|
|
assert.match(result.stdout, /reinstall <app> <path>/i);
|
|
});
|
|
|
|
test('cli --version prints semver and exits 0', () => {
|
|
const result = runCli(['--version']);
|
|
assert.equal(result.status, 0, result.stderr);
|
|
assert.match(result.stdout, /^\d+\.\d+\.\d+/i);
|
|
});
|
|
|
|
test('cli -V prints semver and exits 0', () => {
|
|
const result = runCli(['-V']);
|
|
assert.equal(result.status, 0, result.stderr);
|
|
assert.match(result.stdout, /^\d+\.\d+\.\d+/i);
|
|
});
|
|
|
|
test('cli without command prints usage and exits 1', () => {
|
|
const result = runCli([]);
|
|
assert.equal(result.status, 1, result.stderr);
|
|
assert.match(result.stdout, /agent-device <command>/i);
|
|
});
|