Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Minor refacto. Makin use of the already-there grep method.

R568ccd695dc024
diff --git a/lib/mocha.js b/lib/mocha.js
index 276ef47e..59bdfb52 100644
--- a/lib/mocha.js
+++ b/lib/mocha.js
@@ -67,11 +67,9 @@ function image(name) {
function Mocha(options) {
options = options || {};
- options.grep = 'string' == typeof options.grep
- ? new RegExp(options.grep)
- : options.grep;
this.files = [];
this.options = options;
+ this.grep(options.grep);
this.suite = new exports.Suite('', new exports.Context);
this.ui(options.ui);
this.reporter(options.reporter);
@@ -192,4 +190,4 @@ Mocha.prototype.run = function(fn){
if (options.globals) runner.globals(options.globals);
if (options.growl) this.growl(runner, reporter);
return runner.run(fn);
-};
+};
\ No newline at end of file