Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
fix(config): grep is interpreted as regexp
Browse files Browse the repository at this point in the history
honour regexp characters in the `--grep` argument
  • Loading branch information
refractalize committed May 18, 2015
1 parent e3ae4e0 commit 01d11e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ var createMochaStartFn = function(mocha) {
arrayReduce(clientArguments, function(isGrepArg, arg) {
var match;
if (isGrepArg) {
mocha.grep(arg);
mocha.grep(new RegExp(arg));
} else if (arg === '--grep') {
return true;
} else if (match = /--grep=(.*)/.exec(arg)) {
mocha.grep(match[1]);
mocha.grep(new RegExp(match[1]));
}
return false;
}, false);
Expand Down
4 changes: 2 additions & 2 deletions test/adapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ describe('adapter mocha', function() {
args: ['--grep', 'test test']
});

expect(this.mockMocha.grep.getCall(0).args).to.deep.eq(['test test']);
expect(this.mockMocha.grep.getCall(0).args).to.deep.eq([/test test/]);
});

it('should pass grep argument to mocha if we called the run with --grep=xxx', function() {
Expand All @@ -259,7 +259,7 @@ describe('adapter mocha', function() {
args: ['--grep=test test']
});

expect(this.mockMocha.grep.getCall(0).args).to.deep.eq(['test test']);
expect(this.mockMocha.grep.getCall(0).args).to.deep.eq([/test test/]);
});

it('should pass grep argument to mocha if config.args contains property grep', function(){
Expand Down

0 comments on commit 01d11e6

Please sign in to comment.