Skip to content

Commit 71df19f

Browse files
committed
Unknown command line options produce exit code 1
1 parent 869ad0c commit 71df19f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/command.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function Command(projectBaseDir, examplesDir, print) {
4848
} else {
4949
var env = parseOptions(commands);
5050
if (env.unknownOptions.length > 0) {
51+
process.exitCode = 1;
5152
print('Unknown options: ' + env.unknownOptions.join(', '));
5253
print('');
5354
help({print: print});

spec/command_spec.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,19 @@ describe('command', function() {
113113
});
114114

115115
describe('passing unknown options', function() {
116-
it('display unknown options and usage', function() {
116+
beforeEach(function() {
117+
this.exitCode = process.exitCode;
118+
});
119+
120+
afterEach(function() {
121+
process.exitCode = this.exitCode;
122+
});
123+
124+
it('displays unknown options and usage', function() {
117125
this.command.run(this.fakeJasmine, ['node', 'bin/jasmine.js', '--some-option', '--no-color', '--another-option']);
118126
expect(this.out.getOutput()).toContain('Unknown options: --some-option, --another-option');
119127
expect(this.out.getOutput()).toContain('Usage');
128+
expect(process.exitCode).toBe(1);
120129
});
121130
});
122131

0 commit comments

Comments
 (0)