Make a list of known globals

And fix missing var!

It would be good to get this script running at the end of every test, so we
know that modules aren't leaking either - but it will require a lot
modification of the tests so that they themselves aren't leaking globals.
This commit is contained in:
Ryan Dahl committed 2010-09-14 23:03:29 -07:00
1 parent 77fc61d539
commit feea1330cc
2 files changed
+34 -2

No files matched your search

+2 -2
View File
@@ -534,8 +534,8 @@ var events = module.requireNative('events');
// Signal Handlers
(function() {
var signalWatchers = {};
addListener = process.addListener,
removeListener = process.removeListener;
var addListener = process.addListener;
var removeListener = process.removeListener;
function isSignal (event) {
return event.slice(0, 3) === 'SIG' && process.hasOwnProperty(event);
+32
View File
@@ -0,0 +1,32 @@
var assert = require('assert');
var knownGlobals = [ setTimeout
, setInterval
, clearTimeout
, clearInterval
, console
, Buffer
, process
, global
, __module
, include
, puts
, print
, p
];
for (var x in global) {
var found = false;
for (var y in knownGlobals) {
if (global[x] === knownGlobals[y]) {
found = true;
break;
}
}
if (!found) {
console.error("Unknown global: %s", x);
assert.ok(false);
}
}