Skip to content

RunResult

Structured result from runCommand.

Contains the exit code, captured stdout/stderr output, recorded activity events, and an error field that is undefined on success and a CLIError on failure.

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 non-zero exit, or undefined on success. 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.