runArgv(argv: string[]): Task<number, DaemonRunFailure>
The CLI's path: sends raw argv and answers with the exit code the daemon reported.
Exists as its own entry point so that argv is parsed on the DAEMON. Args.parse needs a
project root, so converting argv into DaemonRunOptions here would make every
daemon-routed qunitx load setup/config.ts and its find-project-root/fs-tree chain —
measured at ~48 ms of module evaluation (63 ms -> 111 ms), against the ~800 ms the daemon
saves. run is the one to reach for otherwise; this trades a narrower answer for the
startup latency the daemon exists to protect.
A Task rather than a promise of a Result, because the two say the same thing and only one of
them nests: await alone gets the exit code, .result() gets the union. Not idempotent — it
streams a whole test run to stdio — and nothing here is worth retrying, since both failures
mean the daemon is gone. Forwards Ctrl+C: the client exits 130 and the daemon abandons the run
when it sees the socket close.
import * as Client from './client.ts'; import * as Failure from '../../result/failure.ts'; // Defined, not invoked: streams the daemon's TAP output to this process's stdio. async function runOnDaemon() { const outcome = await Client.runArgv(['test/foo-test.ts']).result(); // number | DaemonRunFailure return Failure.is(outcome) ? null : outcome; // exit code out; a failure the caller acts on }
Task<number, DaemonRunFailure>