Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

change --grep, regexp escape the input

TJ Holowaychukc21d9a5ad570
diff --git a/bin/_mocha b/bin/_mocha
index d23e34fb..022f7ef2 100755
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -311,7 +311,7 @@ function run(suite, fn) {
var runner = new Runner(suite);
runner.globals(globals);
if (program.ignoreLeaks) runner.ignoreLeaks = true;
- if (program.grep) runner.grep(new RegExp(program.grep), program.invert);
+ if (program.grep) runner.grep(new RegExp(utils.escapeRegexp(program.grep)), program.invert);
var reporter = new Reporter(runner);
if (program.growl) growl(runner, reporter);
runner.run(fn);