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>
This commit is contained in:
parent
76a3e4984c
commit
12de99d982
@ -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…
x
Reference in New Issue
Block a user