Skip to content

Commit

Permalink
test: favor assertions over console logging
Browse files Browse the repository at this point in the history
Communicate about leaked globals via `AssertionError` rather than
`console.log()`.

PR-URL: #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>
  • Loading branch information
Trott authored and MylesBorins committed Mar 9, 2017
1 parent d622b67 commit 53f2848
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ process.on('exit', function() {
if (!exports.globalCheck) return;
var leaked = leakedGlobals();
if (leaked.length > 0) {
console.error('Unknown globals: %s', leaked);
assert.ok(false, 'Unknown global found');
exports.fail(`Unexpected global(s) found: ${leaked.join(', ')}`);
}
});

Expand Down

0 comments on commit 53f2848

Please sign in to comment.