Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports.main = (argv = process.argv.slice(2)) => {
debug('caught error sometime before command handler: %O', err);
yargs.showHelp();
console.error(`\n${symbols.error} ${ansi.red('ERROR:')} ${msg}`);
yargs.exit(1);
process.exitCode = 1;
})
.help('help', 'Show usage information & exit')
.alias('help', 'h')
Expand Down
46 changes: 33 additions & 13 deletions test/integration/init.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,39 @@ describe('init command', function() {
} catch (ignored) {}
});

it('should break if no path supplied', function(done) {
invokeMocha(
['init'],
function(err, result) {
if (err) {
return done(err);
}
expect(result, 'to have failed');
expect(result.output, 'to match', /not enough non-option arguments/i);
done();
},
{stdio: 'pipe'}
);
describe('when no path is supplied', function() {
it('should fail', function(done) {
invokeMocha(
['init'],
function(err, result) {
if (err) {
return done(err);
}
expect(
result,
'to have failed with output',
/not enough non-option arguments/i
);
done();
},
{stdio: 'pipe'}
);
});
it('should not throw', function(done) {
invokeMocha(
['init'],
function(err, result) {
if (err) {
return done(err);
}
expect(result, 'to have failed').and('not to satisfy', {
output: /throw/i
});
done();
},
{stdio: 'pipe'}
);
});
});

it('should create some files in the dest dir', function(done) {
Expand Down