☕️ Classic, reliable, trusted test framework for Node.js and the browser
lib: errno is not a global in node >= v0.9.11
Ben Noordhuise1f2d86da3c6
diff --git a/lib/runner.js b/lib/runner.jsindex f2420f2e..09ed1983 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -58,7 +58,19 @@ function Runner(suite) {this.on('test end', function(test){ self.checkGlobals(test); });this.on('hook end', function(hook){ self.checkGlobals(hook); });this.grep(/.*/);- this.globals(this.globalProps().concat(['errno']));+ 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));}/**diff --git a/mocha.js b/mocha.jsindex e4f8e6b2..78947c62 100644--- a/mocha.js+++ b/mocha.js@@ -4404,7 +4404,19 @@ function Runner(suite) {this.on('test end', function(test){ self.checkGlobals(test); });this.on('hook end', function(hook){ self.checkGlobals(hook); });this.grep(/.*/);- this.globals(this.globalProps().concat(['errno']));+ 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));}/**