Skip to content

RunResult ​

Structured result from runCommand.

Contains the exit code, captured stdout/stderr output, recorded activity events, and an error field. error is undefined when execution completed without throwing, even if the handler requested a non-zero status via Out.setExitCode.

Signatures ​

ts
interface RunResult {}

Members ​

Properties ​

activity ​

Captured spinner and progress lifecycle events.

Recorded separately from stdout/stderr — handlers that call out.spinner() or out.progress() produce events here, enabling targeted assertions on activity lifecycle without parsing text.

ts
activity: readonly ActivityEvent[];

error ​

The error that caused a failure, or undefined when execution completed. A non-zero exitCode can still have no error when a handler calls Out.setExitCode. CLIError instances are preserved; unknown errors are wrapped.

ts
error: CLIError | undefined;

exitCode ​

Process exit code. 0 = success.

ts
exitCode: number;

stderr ​

Captured stderr lines (from out.warn and out.error).

ts
stderr: readonly string[];

stdout ​

Captured stdout lines (from out.log and out.info).

ts
stdout: readonly string[];

Examples ​

ts
const result = await runCommand(greetCmd, ['World']);

expect(result.exitCode).toBe(0);
expect(result.stdout).toContain('Hello, World!');
expect(result.error).toBeUndefined();

See Also ​

Released under the MIT License.