Skip to content

Commit

Permalink
test: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Nov 28, 2020
1 parent ca7649b commit 091ea50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/cli/test/default/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ describe('Default behavior', () => {
const { status, stderr, stdout } = run(['upgraed']);

// Assertions
expect(status).toBe(1);
expect(stderr.toString()).toContain('Invalid command: upgraed.');
expect(stdout.toString()).toContain('Did you mean upgrade?');
expect(status).toBe(1);
});
});
7 changes: 4 additions & 3 deletions lib/cli/test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ const CLI_PATH = path.join(__dirname, '..', 'bin');
/**
* Execute command
* @param {String[]} args - args to be passed in
* @param {Boolean} [cli=true] - invoke the binary
* @param {Object} options - customize the behavior
*
* @returns {Object}
*/
const run = (args, options = {}, cli = true) =>
spawnSync(cli ? 'node' : args[0], cli ? [CLI_PATH].concat(args) : args.slice(1), options);
const run = (args, options = {}) =>
spawnSync('node', [CLI_PATH].concat(args), options);

module.exports = run;

0 comments on commit 091ea50

Please sign in to comment.