Browse Source

test: favor assertions over console logging

Communicate about leaked globals via `AssertionError` rather than
`console.log()`.

PR-URL: https://github.com/nodejs/node/pull/11547
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v7.x
Rich Trott 8 years ago
committed by Italo A. Casas
parent
commit
f193c6f996
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 3
      test/common.js

3
test/common.js

@ -399,8 +399,7 @@ process.on('exit', function() {
if (!exports.globalCheck) return;
const leaked = leakedGlobals();
if (leaked.length > 0) {
console.error('Unknown globals: %s', leaked);
fail('Unknown global found');
fail(`Unexpected global(s) found: ${leaked.join(', ')}`);
}
});

Loading…
Cancel
Save