☕️ Classic, reliable, trusted test framework for Node.js and the browser
Cleanup #1111
Travis Jeffery736c743d8b27
diff --git a/bin/_mocha b/bin/_mochaold mode 100644new mode 100755diff --git a/lib/runner.js b/lib/runner.jsindex 09ed1983..58f20a90 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -58,19 +58,7 @@ function Runner(suite) {this.on('test end', function(test){ self.checkGlobals(test); });this.on('hook end', function(hook){ self.checkGlobals(hook); });this.grep(/.*/);- var extraGlobals = [];- if (typeof(process) === 'object' &&- typeof(process.versions) === 'object' &&- typeof(process.versions.node) === 'string') {- var nodeVersion = process.versions.node.split('.').reduce(function(a, v) {- return a << 8 | v;- });- // 'errno' was renamed to process._errno in v0.9.11.- if (nodeVersion < 0x00090B) {- extraGlobals.push('errno');- }- }- this.globals(this.globalProps().concat(extraGlobals));+ this.globals(this.globalProps().concat(extraGlobals()));}/**@@ -650,3 +638,28 @@ function filterLeaks(ok, globals) {return matched.length == 0 && (!global.navigator || 'onerror' !== key);});}++/**+ * Array of globals dependent on the environment.+ *+ * @return {Array}+ * @api private+ */++ function extraGlobals() {+ if (typeof(process) === 'object' &&+ typeof(process.version) === 'string') {++ var nodeVersion = process.version.split('.').reduce(function(a, v) {+ return a << 8 | v;+ });++ // 'errno' was renamed to process._errno in v0.9.11.++ if (nodeVersion < 0x00090B) {+ return ['errno'];+ }+ }++ return [];+ }diff --git a/mocha.js b/mocha.jsindex 78947c62..c8c9b9ff 100644--- a/mocha.js+++ b/mocha.js@@ -4404,19 +4404,8 @@ function Runner(suite) {this.on('test end', function(test){ self.checkGlobals(test); });this.on('hook end', function(hook){ self.checkGlobals(hook); });this.grep(/.*/);- var extraGlobals = [];- if (typeof(process) === 'object' &&- typeof(process.versions) === 'object' &&- typeof(process.versions.node) === 'string') {- var nodeVersion = process.versions.node.split('.').reduce(function(a, v) {- return a << 8 | v;- });- // 'errno' was renamed to process._errno in v0.9.11.- if (nodeVersion < 0x00090B) {- extraGlobals.push('errno');- }- }- this.globals(this.globalProps().concat(extraGlobals));+ console.log(extraGlobals());+ this.globals(this.globalProps().concat(extraGlobals()));}/**@@ -5001,6 +4990,31 @@ function filterLeaks(ok, globals) {});}+/**+ * Array of globals dependent on the environment.+ *+ * @return {Array}+ * @api private+ */++ function extraGlobals() {+ if (typeof(process) === 'object' &&+ typeof(process.version) === 'string') {++ var nodeVersion = process.version.split('.').reduce(function(a, v) {+ return a << 8 | v;+ });++ // 'errno' was renamed to process._errno in v0.9.11.++ if (nodeVersion < 0x00090B) {+ return ['errno'];+ }+ }++ return [];+ }+}); // module: runner.jsrequire.register("suite.js", function(module, exports, require){