☕️ Classic, reliable, trusted test framework for Node.js and the browser
add support to multiple Mocha#globals() calls, and strings
TJ Holowaychuk11900314d5cb
diff --git a/lib/mocha.js b/lib/mocha.jsindex d98df69d..0ff61519 100644--- a/lib/mocha.js+++ b/lib/mocha.js@@ -210,15 +210,15 @@ Mocha.prototype.growl = function(){};/**- * Ignore `globals`.+ * Ignore `globals` array or string.*- * @param {Array} globals+ * @param {Array|String} globals* @return {Mocha}* @api public*/Mocha.prototype.globals = function(globals){- this.options.globals = globals;+ this.options.globals = (this.options.globals || []).concat(globals);return this;};diff --git a/support/tail.js b/support/tail.jsindex 0f600504..3f8182b7 100644--- a/support/tail.js+++ b/support/tail.js@@ -96,9 +96,8 @@ process.on = function(e, fn){*/mocha.run = function(fn){- var options = this.options;- options.globals = options.globals || [];- options.globals.push('location');+ var options = mocha.options;+ mocha.globals('location');var query = Mocha.utils.parseQuery(window.location.search || '');if (query.grep) mocha.grep(query.grep);