0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-console-no-swallow-stack-overflow.js
Dan Kaplun d49661bb80 console: don't swallow call stack exceeded errors
Fixes test/parallel/test-console-no-swallow-stack-exceeded.js

PR-URL: https://github.com/nodejs/node/pull/19423
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-03-25 20:03:17 -07:00

19 lines
483 B
JavaScript

'use strict';
const common = require('../common');
const { Console } = require('console');
const { Writable } = require('stream');
for (const method of ['dir', 'log', 'warn']) {
common.expectsError(() => {
const out = new Writable({
write: common.mustCall(function write(...args) {
// Exceeds call stack.
return write(...args);
}),
});
const c = new Console(out, out, true);
c[method]('Hello, world!');
}, { name: 'RangeError' });
}