mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
cdc754e6ed
* Avoid interactive children in parent taps * docs: streamline no-skill CLI help * perf: recover faster from sparse iOS trees * fix: preserve selector context for blocked parent taps * fix: preserve coordinate text-entry focus * fix: preserve thin parent touch targets * fix: fail closed for unscoped iOS typing * test: isolate replay lock fixture * test: share node integration process
42 lines
1.4 KiB
TypeScript
42 lines
1.4 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, /agent-device help commands/i);
|
|
|
|
const commands = runCli(['help', 'commands']);
|
|
assert.equal(commands.status, 0, commands.stderr);
|
|
assert.match(commands.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);
|
|
});
|