Skip to content

runCommand

Generated reference page for the runCommand function export.

Signatures

ts
function runCommand(cmd: RunnableCommand, argv: readonly string[], options?: RunOptions): Promise<RunResult>;
ParameterTypeDescription
cmdRunnableCommandThe command builder (must have an action handler)
argvreadonly string[]Raw argv strings (NOT including the command name itself)
optionsRunOptions | undefinedInjectable runtime state

Members

Members

runCommand

Run a command builder against the given argv with injected options.

This is the testkit wrapper around the shared executor:

  1. Create or reuse capture output
  2. Build standalone schema/meta defaults when CLI dispatch did not
  3. Delegate parse -> resolve -> execute to the shared executor
  4. Return the structured result with captured buffers

Errors are normalized by the shared executor into structured RunResults with appropriate exit codes. The function never throws.

ts
(cmd: RunnableCommand, argv: readonly string[], options?: RunOptions): Promise<RunResult>;

See Also

Released under the MIT License.