@@ -279,34 +279,36 @@ if (global.gc) { |
|
|
279 |
279 |
knownGlobals.push(global.gc); |
280 |
280 |
} |
281 |
281 |
|
282 |
|
-if (process.env.NODE_TEST_KNOWN_GLOBALS) { |
283 |
|
-const knownFromEnv = process.env.NODE_TEST_KNOWN_GLOBALS.split(','); |
284 |
|
-allowGlobals(...knownFromEnv); |
285 |
|
-} |
286 |
|
- |
287 |
282 |
function allowGlobals(...whitelist) { |
288 |
283 |
knownGlobals = knownGlobals.concat(whitelist); |
289 |
284 |
} |
290 |
285 |
|
291 |
|
-function leakedGlobals() { |
292 |
|
-const leaked = []; |
|
286 |
+if (process.env.NODE_TEST_KNOWN_GLOBALS !== '0') { |
|
287 |
+if (process.env.NODE_TEST_KNOWN_GLOBALS) { |
|
288 |
+const knownFromEnv = process.env.NODE_TEST_KNOWN_GLOBALS.split(','); |
|
289 |
+allowGlobals(...knownFromEnv); |
|
290 |
+} |
293 |
291 |
|
294 |
|
-for (const val in global) { |
295 |
|
-if (!knownGlobals.includes(global[val])) { |
296 |
|
-leaked.push(val); |
|
292 |
+function leakedGlobals() { |
|
293 |
+const leaked = []; |
|
294 |
+ |
|
295 |
+for (const val in global) { |
|
296 |
+if (!knownGlobals.includes(global[val])) { |
|
297 |
+leaked.push(val); |
|
298 |
+} |
297 |
299 |
} |
|
300 |
+ |
|
301 |
+return leaked; |
298 |
302 |
} |
299 |
303 |
|
300 |
|
-return leaked; |
|
304 |
+process.on('exit', function() { |
|
305 |
+const leaked = leakedGlobals(); |
|
306 |
+if (leaked.length > 0) { |
|
307 |
+assert.fail(`Unexpected global(s) found: ${leaked.join(', ')}`); |
|
308 |
+} |
|
309 |
+}); |
301 |
310 |
} |
302 |
311 |
|
303 |
|
-process.on('exit', function() { |
304 |
|
-const leaked = leakedGlobals(); |
305 |
|
-if (leaked.length > 0) { |
306 |
|
-assert.fail(`Unexpected global(s) found: ${leaked.join(', ')}`); |
307 |
|
-} |
308 |
|
-}); |
309 |
|
- |
310 |
312 |
const mustCallChecks = []; |
311 |
313 |
|
312 |
314 |
function runCallChecks(exitCode) { |