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>
v6
Rich Trott 8 years ago
committed by James M Snell
parent
commit
12de99d982
  1. 3
      test/common.js

3
test/common.js

@ -402,8 +402,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