tony-go / clix

Write acceptance tests easily for your CLI program.
21 stars 2 forks source link

feat(process): have proper error message when process is failing #3

Closed tony-go closed 2 years ago

tony-go commented 2 years ago

Current behavior

When a user passes a wrong command, it will fail silently.

const scenario = clix('command that fail')
    .expect('poof').

const { ok } = await scenario.run();

// the run doesn't throw 😱
// ok === false

Expected behavior

const scenario = clix('command-foo')
    .expect('poof').

try {
    const { ok } = await scenario.run();
} catch (e) {
    // .run() should we should catch an error
    // e === new Error('Run command-foo failed: <error>');
}