Skip to content

Commit af16759

Browse files
author
Gregg Van Hove
committed
Merge branch 'c4dt-master'
- Merges #155 from @tharvik
2 parents f0c0d7d + 6c14ba2 commit af16759

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/command.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ function parseOptions(argv) {
7878
seed,
7979
workerCount;
8080

81-
argv.forEach(function(arg) {
81+
for (var i in argv) {
82+
var arg = argv[i];
8283
if (arg === '--no-color') {
8384
color = false;
8485
} else if (arg === '--color') {
@@ -103,12 +104,14 @@ function parseOptions(argv) {
103104
configPath = arg.match("^--config=(.*)")[1];
104105
} else if (arg.match("^--reporter=")) {
105106
reporter = arg.match("^--reporter=(.*)")[1];
107+
} else if (arg === '--') {
108+
break;
106109
} else if (isFileArg(arg)) {
107110
files.push(arg);
108111
} else if (!isEnvironmentVariable(arg)) {
109112
unknownOptions.push(arg);
110113
}
111-
});
114+
}
112115
return {
113116
color: color,
114117
configPath: configPath,
@@ -180,7 +183,7 @@ function installExamples(options) {
180183

181184
function help(options) {
182185
var print = options.print;
183-
print('Usage: jasmine [command] [options] [files]');
186+
print('Usage: jasmine [command] [options] [files] [--]');
184187
print('');
185188
print('Commands:');
186189
Object.keys(subCommands).forEach(function(cmd) {
@@ -206,6 +209,7 @@ function help(options) {
206209
print('%s\tpath to your optional jasmine.json', lPad('--config=', 18));
207210
print('%s\tpath to reporter to use instead of the default Jasmine reporter', lPad('--reporter=', 18));
208211
print('%s\tnumber of workers to run the tests in parallel. Default is 1', lPad('--worker-count=', 18));
212+
print('%s\tmarker to signal the end of options meant for Jasmine', lPad('--', 18));
209213
print('');
210214
print('The given arguments take precedence over options in your jasmine.json');
211215
print('The path to your optional jasmine.json can also be configured by setting the JASMINE_CONFIG_PATH environment variable');

spec/command_spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ describe('command', function() {
129129
});
130130
});
131131

132+
describe('--', function() {
133+
it('skips anything after it', function() {
134+
this.command.run(this.fakeJasmine, ['node', 'bin/jasmine.js', '--', '--no-color']);
135+
expect(this.out.getOutput()).toBe('');
136+
expect(this.fakeJasmine.showColors).toHaveBeenCalledWith(true);
137+
});
138+
});
139+
132140
describe('examples', function() {
133141
beforeEach(function() {
134142
this.command.run(this.fakeJasmine, ['node', 'bin/jasmine.js', 'examples']);

0 commit comments

Comments
 (0)