Anna Henningsen
8 years ago
No known key found for this signature in database
GPG Key ID: D8B9F5AEAE84E4CF
3 changed files with
57 additions and
50 deletions
-
lib/console.js
-
test/parallel/test-console-async-write-error.js
-
test/parallel/test-console-sync-write-error.js
|
|
@ -103,7 +103,10 @@ Console.prototype.error = Console.prototype.warn; |
|
|
|
|
|
|
|
Console.prototype.dir = function dir(object, options) { |
|
|
|
options = Object.assign({customInspect: false}, options); |
|
|
|
write(this._ignoreErrors, this._stdout, `${util.inspect(object, options)}\n`); |
|
|
|
write(this._ignoreErrors, |
|
|
|
this._stdout, |
|
|
|
`${util.inspect(object, options)}\n`, |
|
|
|
this._stdoutErrorHandler); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4,6 +4,7 @@ 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) => { |
|
|
|
process.nextTick(callback, new Error('foobar')); |
|
|
@ -13,5 +14,6 @@ const out = new Writable({ |
|
|
|
const c = new Console(out, out, true); |
|
|
|
|
|
|
|
assert.doesNotThrow(() => { |
|
|
|
c.log('abc'); |
|
|
|
c[method]('abc'); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
@ -4,6 +4,7 @@ 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) => { |
|
|
@ -14,7 +15,7 @@ const assert = require('assert'); |
|
|
|
const c = new Console(out, out, true); |
|
|
|
|
|
|
|
assert.doesNotThrow(() => { |
|
|
|
c.log('abc'); |
|
|
|
c[method]('abc'); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -28,7 +29,7 @@ const assert = require('assert'); |
|
|
|
const c = new Console(out, out, true); |
|
|
|
|
|
|
|
assert.doesNotThrow(() => { |
|
|
|
c.log('abc'); |
|
|
|
c[method]('abc'); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -42,6 +43,7 @@ const assert = require('assert'); |
|
|
|
const c = new Console(out, out, true); |
|
|
|
|
|
|
|
assert.doesNotThrow(() => { |
|
|
|
c.log('abc'); |
|
|
|
c[method]('abc'); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|