Skip to content

Commit

Permalink
Cleanup #1111
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Jan 18, 2014
1 parent 744702b commit 736c743
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 26 deletions.
Empty file modified bin/_mocha
100644 → 100755
Empty file.
39 changes: 26 additions & 13 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

/**
Expand Down Expand Up @@ -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 [];
}
40 changes: 27 additions & 13 deletions mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

/**
Expand Down Expand Up @@ -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.js

require.register("suite.js", function(module, exports, require){
Expand Down

0 comments on commit 736c743

Please sign in to comment.