class ShellTester

API for the shell-tester library. Create a ShellTester instance to test your shell setup.

Constructors

(constructor)(options)

Constructs a new instance of the ShellTester class

Parameters
Name Type Description

options

ShellTesterOptions

The options to create the ShellTester.

Signature
constructor(options?: ShellTesterOptions);

Methods

run(argv)

Runs the registered sessions.

Parameters
Name Type Description

argv

string[]

The command line arguments. If no argument is passed, it will run all the registered sessions. If an argument is passed, it will run only the session with the matching name.

Returns

Promise<void>

Signature
run(argv?: string[]): Promise<void>;

session(name, callback)

Register a new session to be tested. The session will not be run until run() is called.

Parameters
Name Type Description

name

string

The session name. This can be used to filter the session to be run from the command line.

callback

(session: ShellSession) => Promise<void>

An async function that automates this shell session. The function will be called with a ShellSession instance.

Returns

void

Signature
session(name: string, callback: (session: ShellSession) => Promise<void>): void;