☕️ Classic, reliable, trusted test framework for Node.js and the browser
refactor
TJ Holowaychuke6ab8956488b
diff --git a/lib/runner.js b/lib/runner.jsindex 3e716c69..fdb2565e 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -11,6 +11,19 @@ var EventEmitter = require('events').EventEmitter, keys = utils.keys, noop = function(){};+/**+ * Non-enumerable globals.+ */++var globals = [+ 'setTimeout',+ 'clearTimeout',+ 'setInterval',+ 'clearInterval',+ 'XMLHttpRequest',+ 'Date'+];+/*** Expose `Runner`.*/@@ -97,23 +110,19 @@ Runner.prototype.grepTotal = function(suite) {/*** Return a list of global properties.*- * @return {Array} list of properties.+ * @return {Array}* @api private*/+Runner.prototype.globalProps = function() {- var common = [- 'setTimeout', 'clearTimeout', 'setInterval',- 'clearInterval', 'Date', 'XMLHttpRequest'- ];- // these are only enumerable properties.var props = utils.keys(global);- // now let's add some common non enumerable properties.- for (var i = 0; i < common.length; i++) {- if (props.indexOf(common[i]) === -1) {- props.push(common[i]);- }+ // non-enumerables+ for (var i = 0; i < globals.length; ++i) {+ if (~props.indexOf(globals[i])) continue;+ props.push(globals[i]);}+return props;};