Skip to content

Commit

Permalink
test: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSTL committed Dec 18, 2020
1 parent 93b58ab commit 8ee5ea6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions __e2e__/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { run } from '../jest/helpers';

describe('Default behavior', () => {
it('warns the user if an unknown option is passed in', () => {
const { stderr, exitCode } = run(['--invalid'], { reject: false });
const { exitCode, stderr } = run(['--invalid'], { reject: false });
expect(exitCode).toBe(1);
expect(stderr).toContain(`error: unknown option`);
});

it('warns the user if an unknown command is passed in', () => {
const { exitCode, stdout } = run(['create'], { reject: false });
const { exitCode, stderr } = run(['create'], { reject: false });
expect(exitCode).toBe(1);
expect(stdout).toContain('Unknown command create');
expect(stderr).toContain('Unknown command create');
});

it('suggests the closest match for an unknown command', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ program.on('command:*', ([cmd]) => {
console.error(` Unknown command ${chalk.yellow(cmd)}.`);
console.log();
suggestCommands(cmd);
process.exitCode = 1;
process.exit(1);
});

program.parse(process.argv);
Expand Down

0 comments on commit 8ee5ea6

Please sign in to comment.