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

Commit

Permalink
Merge pull request #61 from featurist/master
Browse files Browse the repository at this point in the history
--grep doesn't do regular expressions
  • Loading branch information
maksimr committed May 19, 2015
2 parents e3ae4e0 + 01d11e6 commit 85a13e1
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 85a13e1

Please sign in to comment.