mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
c969047d62
Apply the `console: do not emit error events` changes properly to `console.dir()`. This was overlooked inf18e08d820
(https://github.com/nodejs/node/pull/9744). Ref:f18e08d820 (commitcomment-20934407)
PR-URL: https://github.com/nodejs/node/pull/11443 Reviewed-By: James M Snell <jasnell@gmail.com>
50 lines
1016 B
JavaScript
50 lines
1016 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const { Console } = require('console');
|
|
const { Writable } = require('stream');
|
|
const assert = require('assert');
|
|
|
|
for (const method of ['dir', 'log', 'warn']) {
|
|
{
|
|
const out = new Writable({
|
|
write: common.mustCall((chunk, enc, callback) => {
|
|
callback(new Error('foobar'));
|
|
})
|
|
});
|
|
|
|
const c = new Console(out, out, true);
|
|
|
|
assert.doesNotThrow(() => {
|
|
c[method]('abc');
|
|
});
|
|
}
|
|
|
|
{
|
|
const out = new Writable({
|
|
write: common.mustCall((chunk, enc, callback) => {
|
|
throw new Error('foobar');
|
|
})
|
|
});
|
|
|
|
const c = new Console(out, out, true);
|
|
|
|
assert.doesNotThrow(() => {
|
|
c[method]('abc');
|
|
});
|
|
}
|
|
|
|
{
|
|
const out = new Writable({
|
|
write: common.mustCall((chunk, enc, callback) => {
|
|
setImmediate(() => callback(new Error('foobar')));
|
|
})
|
|
});
|
|
|
|
const c = new Console(out, out, true);
|
|
|
|
assert.doesNotThrow(() => {
|
|
c[method]('abc');
|
|
});
|
|
}
|
|
}
|