Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V5.11.0 proposal #6321

Closed
wants to merge 1,219 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
1219 commits
Select commit Hold shift + click to select a range
31e39fb
doc: remove non-standard use of hyphens
svozza Mar 12, 2016
9794abb
doc: add onboarding resources
Fishrock123 Nov 9, 2015
b667573
doc: update fansworld-claudio username on README
claudiorodriguez Mar 13, 2016
44a9b10
doc: fix typo in api/fs
watilde Mar 13, 2016
8e45c9d
doc: fix typo in api/dgram
watilde Mar 13, 2016
c579507
doc: fix typo in api/addons
watilde Mar 13, 2016
eb73574
doc: clarify when writable.write callback is called
kevinoid Jan 22, 2016
29510aa
deps: update openssl config
Mar 6, 2016
62926d8
doc: clarify type of first argument in zlib
fanatid Mar 13, 2016
b16f67a
net: make `isIPv4` and `isIPv6` more efficient
vkurchatkin Feb 28, 2016
ef774ff
zlib: add support for concatenated members
kthelgason Feb 3, 2016
434af03
doc: Add note about use of JSON.stringify()
mithun-daa Mar 15, 2016
8c4c84f
doc: add Testing WG
Trott Feb 26, 2016
4ecd996
src: allow combination of -i and -e cli flags
Trott Mar 11, 2016
5e9cac4
console: check that stderr is writable
Trott Mar 9, 2016
b6c355d
deps: backport fb4ccae from v8 upstream
develar Dec 15, 2015
79cb1a9
2016-03-16, Version 5.9.0 (Stable)
evanlucas Mar 16, 2016
0cac777
Working on v5.9.1
evanlucas Mar 16, 2016
c5d8369
contextify: tie lifetimes of context & sandbox
ofrobots Mar 18, 2016
6e5835b
path: refactor path.format() repeated code
Trott Mar 12, 2016
5ab51ee
doc: reformat & improve node.1 manual page
Fishrock123 Feb 29, 2016
89df17e
doc: fix return value of write methods
fb55 Mar 16, 2016
f34a00c
docs: fix man pages link if tok type is code
mithun-daa Mar 15, 2016
724b87d
doc: explain path.format() algorithm
Trott Mar 13, 2016
75f723c
doc: fix invalid path doc comments
Trott Mar 11, 2016
3bff311
https: fix ssl socket leak when keepalive is used
alexpenev-s Mar 14, 2016
15c5662
doc: fix multiline return comments in querystring
claudiorodriguez Mar 14, 2016
d8318c2
doc: fix crypto update() signatures
mscdex Mar 1, 2016
d9b4e15
doc: fix typo in synchronous randomBytes example
WebReflection Mar 18, 2016
b1a4870
tools: remove unused imports
thefourtheye Mar 17, 2016
d3654d8
timers: improve setImmediate() performance
mscdex Dec 6, 2015
21770c3
test: reduce brittleness of tab complete test
Mar 17, 2016
5d28ce3
doc: topic blocking vs non-blocking
jrit Feb 19, 2016
3ada8cc
doc: align doc/api/tls.markdown with style guide
svozza Mar 14, 2016
1ccf9b4
net: remove unused `var self = this` from old code
benjamingr Feb 14, 2016
15c7b3a
src,tools: use template literals
Trott Mar 18, 2016
f53cc37
doc: grammar, clarity and links in timers doc
bengl Mar 18, 2016
ae24d05
deps: remove unused openssl files
bnoordhuis Mar 8, 2016
20a68e9
timers: give Timeouts a constructor name
Fishrock123 Mar 18, 2016
b352cc7
test: minimize test-http-get-pipeline-problem
Trott Mar 15, 2016
3fef69b
dns: use isIp consistently
benjamingr Mar 19, 2016
f0d885a
test: fix flaky test-cluster-shared-leak
claudiorodriguez Mar 19, 2016
d2fa644
test: fix `test-cluster-worker-kill`
santigimeno Mar 20, 2016
0ffd794
doc: Add windows example for Path.format
mithun-daa Mar 14, 2016
46f0e02
timers: fix lint from 4fe02e2
Fishrock123 Mar 21, 2016
89f091d
test: make test-net-connect-options-ipv6.js better
mhdawson Mar 18, 2016
e99082e
doc: add a cli options doc page
Fishrock123 Mar 18, 2016
e20d0b8
doc: explain error message on missing main file
drywolf Mar 20, 2016
c75f97f
lib: reduce usage of `self = this`
JacksonTian Feb 15, 2016
7ab597d
doc: add CTC meeting minutes 2016-02-03
rvagg Feb 17, 2016
1631f06
doc: add CTC meeting minutes 2016-02-10
rvagg Feb 17, 2016
7b21c09
lib: simplify code with String.prototype.repeat()
JacksonTian Feb 19, 2016
d2d0fe9
doc: update crypto docs to use good defaults
billautomata Mar 1, 2016
70512e5
test: repl tab completion test
santigimeno Mar 2, 2016
7c2c7b0
test: remove timer from test-http-1.0
santigimeno Feb 7, 2016
341b3d0
benchmark: fix linting errors
Trott Mar 22, 2016
72fb796
buffer: throw range error before truncating write
Mar 8, 2016
f95fc17
test: strip non-free icc profile from person.jpg
kapouer Mar 20, 2016
ca971b0
test: smaller chunk size for smaller person.jpg
kapouer Mar 20, 2016
54abbe7
dns: use template literals
benjamingr Mar 20, 2016
195e058
2016-03-23, Version 5.9.1 (Stable)
Fishrock123 Mar 21, 2016
90c2063
Working on v5.9.2
Fishrock123 Mar 22, 2016
3c02727
buffer: backport --zero-fill-buffers command line option
jasnell Mar 16, 2016
c1534e7
buffer: backport new buffer constructor APIs
jasnell Mar 17, 2016
8fa0b5c
Add @mhdawson back to the CTC
jasnell Mar 9, 2016
f1488bb
src,http_parser: remove KickNextTick call
trevnorris Mar 11, 2016
f9d0166
src: reword command and add ternary
trevnorris Mar 23, 2016
a485612
async_wrap: setupHooks now accepts object
trevnorris Feb 22, 2016
6f16882
async_wrap: notify post if intercepted exception
trevnorris Feb 23, 2016
2cbbaaf
async_wrap: don't abort on callback exception
trevnorris Mar 14, 2016
bdf933b
buffer: changing let in for loops back to var
gareth-ellis Mar 21, 2016
1f8e4b5
buffer: add swap16() and swap32() methods
jasnell Mar 15, 2016
ee83c95
buffer: make byteLength work with ArrayBuffer & DataView
JacksonTian Feb 16, 2016
5681ffe
build: enable compilation for linuxOne
mhdawson Mar 28, 2016
5ee5fa2
build: add missing `openssl_fips%` to common.gypi
indutny Mar 27, 2016
389f5a8
build: add script to create Android .mk files
robertchiras Mar 3, 2016
58b5c1e
build: add suport for x86 architecture
robertchiras Mar 3, 2016
660ec9f
child_process: refactor self=this in socket_list
benjamingr Mar 23, 2016
ec18131
deps: backport 8d00c2c from v8 upstream
bnoordhuis Mar 6, 2016
6a6112a
dns: Use object without protoype for map
benjamingr Mar 22, 2016
2a5c6d7
dns: Refactor forEach to map
benjamingr Mar 22, 2016
f1f9aff
doc: fix doc for Buffer.readInt32LE()
ghaiklor Mar 24, 2016
8e790b7
doc: add instructions to only sign a release
Fishrock123 Mar 23, 2016
949b17f
doc: fix order of end tags of list after heading
Mar 3, 2016
2977839
doc: use consistent event name parameter
benjamingr Mar 22, 2016
5676a35
doc: explain path.format expected properties
eversojk Mar 19, 2016
858a524
doc: typo: interal->internal.
kosak Mar 22, 2016
731f7b8
etw: fix descriptors of events 9 and 23
joaocgreis Mar 16, 2016
80155d3
fs: add the fs.mkdtemp() function.
ralt Feb 24, 2016
63c601b
http: speed up checkIsHttpToken
JacksonTian Jan 21, 2016
afcd276
zlib: Fix handling of gzip magic bytes mid-file
addaleax Mar 23, 2016
77bed26
win,build: build and test add-ons on test-ci
Mar 24, 2016
cb676cf
tools: fix json doc generation
firedfox Mar 29, 2016
7ec5397
timers: fixing API refs to use safe internal refs
getify Aug 22, 2015
8344a52
test: fix test-debugger-client.js
Trott Mar 22, 2016
fb0c5bc
test: fix flaky test-http-set-timeout
Trott Mar 23, 2016
82a50d3
test: move dns test to test/internet
bnoordhuis Mar 25, 2016
a41fd93
test: fix flaky test-net-socket-timeout
mscdex Mar 24, 2016
3238bff
test: confirm globals not used internally
Trott Mar 24, 2016
6928a17
test: exclude new fs watch test for AIX
mhdawson Mar 28, 2016
a19de97
test: remove the use of curl in the test suite
santigimeno Mar 16, 2016
aebe624
test: add test for piping large input from stdin
addaleax Mar 29, 2016
0d0c57f
src: override v8 thread defaults using cli options
tomgco Dec 18, 2015
4271732
repl: support standalone blocks
princejwesley Mar 7, 2016
a2ad216
querystring: don't stringify bad surrogate pair
mscdex Mar 23, 2016
b07bc5d
net: emit host in lookup event
entertainyou Mar 8, 2016
e6fabfc
deps: upgrade npm to 3.8.3
othiym23 Mar 30, 2016
16a53e3
lib: refactor code with startsWith/endsWith
JacksonTian Mar 17, 2016
bfd723f
src: Add missing `using v8::MaybeLocal`
addaleax Mar 31, 2016
32bd75a
lib,src: refactor src/node.js into internal files
Fishrock123 Mar 15, 2016
e571b14
lib,src: move src/node.js to lib/internal/node.js
Fishrock123 Mar 15, 2016
4ecb88f
lib: rename /node.js to /bootstrap_node.js
Fishrock123 Mar 15, 2016
0acca76
test: fix flaky test-repl
mscdex Mar 25, 2016
6113f6a
test: mitigate flaky test-https-agent
Trott Mar 28, 2016
c5c7ae8
test: add known_issues test for GH-2148
Trott Mar 27, 2016
e8cdf9a
node: --no-browser-globals configure flag
indutny Mar 23, 2016
40f0175
etw,build: always generate .rc and .h files
joaocgreis Mar 11, 2016
c7dcffb
governance: remove target size for CTC
Trott Mar 23, 2016
79ea8c3
2016-03-31 Version 5.10.0 (Stable) Release
evanlucas Mar 31, 2016
0605555
Working on v5.10.1
evanlucas Apr 1, 2016
e966d1f
buffer: don't set `kNoZeroFill` flag in allocUnsafe
vkurchatkin Apr 1, 2016
f3f19ee
net: refactor self=this to arrow functions
benjamingr Mar 23, 2016
0a13099
etw: add event messages
joaocgreis Mar 21, 2016
f14d71c
test: stdin is not always a net.Socket
Fishrock123 Mar 28, 2016
4f1fa2a
test: fix offending max-len linter error
thefourtheye Mar 31, 2016
96bb315
test: ensure _handle property existence
Trott Mar 26, 2016
c6ac6f2
http: Corrects IPv6 address in Host header
mpotra Feb 19, 2016
3f75751
build: introduce ci targets for lint/benchmark
jbergstroem Mar 27, 2016
a40b0cb
test: refactor http-end-throw-socket-handling
santigimeno Mar 12, 2016
8bec8aa
doc: consolidate timers docs in timers.markdown
bengl Mar 21, 2016
0ae5d02
doc: clarify that __dirname is module local
jasnell Apr 2, 2016
7337ef6
doc: minor argument formatting in stream.markdown
jasnell Apr 2, 2016
7491fdc
tools: remove disabling of already-disabled rule
Trott Apr 2, 2016
ce17371
doc: add 'Command Line Options' to 'View on single page'
firedfox Apr 2, 2016
f12c386
doc: clarify stdout/stderr arguments to callback
jasnell Apr 2, 2016
f879f5e
doc: document unspecified behavior for buf.write* methods
jasnell Mar 27, 2016
6052ced
test: fix error message checks in test-module-loading
jasnell Apr 1, 2016
0127c2b
test: fix test-dns.js flakiness
Trott Apr 1, 2016
dd25984
doc: note assert.throws() pitfall
Trott Apr 3, 2016
2ab1237
test: fix flaky test-net-socket-timeout-unref
Trott Mar 29, 2016
aa9fb03
doc: use HTTPS for links where possible
Trott Apr 2, 2016
1c40079
path: fix win32.isAbsolute() inconsistency
mscdex Apr 3, 2016
02f2ebd
test: explicitly set global in test-repl
Trott Apr 3, 2016
7db7a82
test: make arch available in status files
santigimeno Apr 1, 2016
cc8fcc5
test: be explicit about polluting of `global`
Trott Apr 2, 2016
059b607
test: make use of globals explicit
Trott Apr 2, 2016
0f5a51a
assert: Check typed array view type in deepEqual
addaleax Mar 26, 2016
50a062e
tools: remove obsolete lint config file
Trott Mar 30, 2016
8317778
meta: add "joining a wg" section to WORKING_GROUPS.md
mcollina Feb 29, 2016
781290b
doc: refine child_process detach behaviour
eljefedelrodeodeljefe Feb 19, 2016
5c4a414
2016-04-05, Version 5.10.1 (Stable) Release
Apr 5, 2016
fc19a8b
Working on v5.10.2
Apr 5, 2016
60a73a2
doc: fix a typo in 5.10.1's changelog
Apr 6, 2016
2fd8be2
src: replace ARRAY_SIZE with typesafe arraysize
bnoordhuis Mar 31, 2016
20bb92f
src: use size_t for http parser array size fields
bnoordhuis Mar 31, 2016
61167c3
zlib: fix gzip member head/buffer boundary issue
addaleax Mar 24, 2016
d4abca5
lib: remove bootstrap global context indirection
Fishrock123 Mar 23, 2016
6d9c0c9
net: support DNS hints in createConnection()
cjihrig Apr 1, 2016
8da4bad
test: fix pummel test failures
Trott Apr 2, 2016
fbc99ba
src: add missing 'inline' keywords
bnoordhuis Apr 5, 2016
bc0ee06
doc: note about Android support
Trott Apr 4, 2016
a27e952
test: enforce strict mode for test-domain-crypto
Trott Apr 4, 2016
a5f8d0c
build: remove -f{data,function}-sections flags
bnoordhuis Apr 6, 2016
07829b0
doc: simple doc typo fix
BrendonPierson Apr 4, 2016
96ad5c5
doc: update openssl LICENSE using license-builder.sh
srl295 Apr 5, 2016
632e6b9
deps: backport 125ac66 from v8 upstream
Apr 6, 2016
6bb7999
test: refactor test-file-write-stream3
Trott Apr 5, 2016
440d117
doc: add example using algorithms not directly exposed
hillbrad Apr 7, 2016
d44540f
buffer: standardize array index check
trevnorris Apr 6, 2016
a81fca4
doc: add topic - event loop, timers, `nextTick()`
techjeffharris Apr 8, 2016
2254f1a
repl: refactor repl.js
Trott Apr 6, 2016
fc89d17
path: fixing a test that breaks on some machines.
Apr 5, 2016
476535c
test: fix flaky test-http-client-abort
Trott Apr 8, 2016
a40d0e8
doc: fix scrolling on iOS devices
lpinca Mar 23, 2016
a2dd848
tools,doc: fix incomplete json produced by doctool
firedfox Mar 31, 2016
69eb4a6
tools,doc: fix json for grouped optional params
firedfox Mar 31, 2016
5e6915f
doc: describe child.kill() pitfalls on linux
eljefedelrodeodeljefe Apr 5, 2016
daaad47
doc: clarification for maxBuffer and Unicode output
jasnell Apr 9, 2016
b26fea1
doc: add copy about how to curl SHA256.txt
Apr 8, 2016
4392b4a
stream: Fix readableState.awaitDrain mechanism
addaleax Apr 2, 2016
fabc33a
tools: remove simplejson dependency
thefourtheye Apr 7, 2016
a38b614
test: fix flaky test-child-process-fork-net
Trott Apr 9, 2016
a7104e4
deps: cherry-pick 1383d00 from v8 upstream
indutny Apr 13, 2016
f69416c
streams: support unlimited synchronous cork/uncork cycles
mcollina Apr 12, 2016
5382dea
repl: don’t complete non-simple expressions
addaleax Apr 14, 2016
4fa949e
doc: fix incorrect references in buffer docs
Amery2010 Apr 14, 2016
e3e544e
deps: upgrade npm to 3.8.6
zkat Apr 11, 2016
8ae200c
deps: floating fix for npm's test-node script
zkat Apr 11, 2016
332f738
benchmark: add module loader benchmark parameter
mscdex Feb 10, 2016
976e4bb
doc: add addaleax to collaborators
addaleax Apr 15, 2016
a1c46b6
doc: add santigimeno to collaborators
santigimeno Apr 15, 2016
117348d
doc: add iWuzHere to collaborators
imran-iq Apr 15, 2016
a91834e
doc: add stefanmb to collaborators
stefanmb Apr 15, 2016
f3c0b78
doc: add domain postmortem
trevnorris Apr 11, 2016
d809c84
test,vm: enable strict mode for vm tests
Trott Apr 15, 2016
5f9c829
doc: clarify fs.watch() and inodes on linux, os x
jorangreef Apr 7, 2016
d516412
tools,doc: parse types in braces everywhere
estliberitas Feb 20, 2016
1d40809
process: fix incorrect usage of assert.fail()
Trott Apr 15, 2016
3f73502
doc: native module reloading is not supported
bengl Apr 12, 2016
edd8a15
test,repl: use deepStrictEqual for false-y values
Fishrock123 Apr 14, 2016
3bc3152
doc: explain differences in console.assert between node and browsers
jasnell Apr 12, 2016
6e891c7
gitignore: ignore VS 2015 *.VC.opendb files
Apr 5, 2016
b57be92
gitignore: adding .vs/ directory to .gitignore
Apr 13, 2016
a6056c4
tools: fix license-builder.sh again for ICU
srl295 Apr 5, 2016
3b00d7a
doc: document intention and dangers of fs module Buffer API
seishun Apr 2, 2016
b49a5b3
doc: fix http response event, Agent#getName
mdouglass Apr 1, 2016
fa04dfc
doc: DCO anchor that doesn't change
williamkapke Apr 18, 2016
dc1552e
doc: replace functions with arrow functions
hiroppy Apr 14, 2016
14fcb1d
assert: respect assert.doesNotThrow message.
Aug 17, 2015
be993fc
test: fix test-net-settimeout flakiness
santigimeno Apr 12, 2016
056a258
test: fix flaky test-http-set-timeout-server
santigimeno Apr 15, 2016
d9b8758
tools: update ESLint to 2.7.0
silverwind Apr 9, 2016
c0e9c94
test: fix issues for ESLint 2.7.0
silverwind Apr 9, 2016
c8783af
lib,test,tools: alignment on variable assignments
Trott Apr 16, 2016
be070d7
tools: lint for alignment of variable assignments
Trott Apr 16, 2016
f201b01
tools: improve js linter
mscdex Mar 10, 2016
3c8d404
build: allow test-ci to run tests in parallel
jbergstroem Apr 15, 2016
1d130d0
test: move the debugger tests back to parallel
santigimeno Apr 15, 2016
9856b80
test: move some test from sequential to parallel
santigimeno Apr 5, 2016
d66d883
doc: path.format provide more examples
eversojk Mar 22, 2016
a2ca347
tools: move message listener to worker objects
mscdex Apr 15, 2016
985685d
doc: fix broken references
gromnitsky Apr 13, 2016
5b42ef5
test: move debugger tests to sequential
Trott Apr 14, 2016
a259ee4
http: unref socket timer on parser execute
indutny Apr 19, 2016
20dcdd3
stream_base: expose `bytesRead` getter
indutny Apr 19, 2016
d5d4f19
net: replace __defineGetter__ with defineProperty
indutny Apr 20, 2016
473f086
buffer: add Buffer.prototype.compare by offset
jasnell Mar 23, 2016
7d54d85
src: add SIGINFO to supported signals
jamesreggio Apr 7, 2016
5305831
deps: update to http-parser 2.7.0
indutny Apr 19, 2016
16b23b2
http: skip body and next message of CONNECT res
indutny Apr 19, 2016
4e4efb7
test: add test for responses to HTTP CONNECT req
slushie Apr 19, 2016
bd12d72
build: fix make tar-headers for Linux
gibfahn Mar 31, 2016
fff6a84
tools: enable linting for v8_prof_processor.js
Trott Apr 18, 2016
4a1dfdc
tools: lint rule for assert.fail()
Trott Apr 18, 2016
48ecc0b
test,tools: enable linting for undefined vars
Trott Apr 18, 2016
96be986
test: assert - fixed error messages to match the tests
suryagh Apr 16, 2016
adfb1a4
child_process: add nullptr checks after allocs
addaleax Apr 18, 2016
99d0a61
test: move more tests from sequential to parallel
santigimeno Apr 9, 2016
1fb4052
debugger: run last command on presssing enter
Trott Apr 6, 2016
2c23e14
zlib: detect gzip files when using unzip*
addaleax Mar 24, 2016
83bc0a2
zlib: Make the finish flush flag configurable
addaleax Apr 5, 2016
457f24f
node: make builtin libs available for `--eval`
addaleax Apr 15, 2016
07c9f98
repl: keep the built-in modules non-enumerable
addaleax Apr 18, 2016
50f3f10
doc: note that zlib.flush acts after pending writes
addaleax Apr 12, 2016
e6f4a17
doc: add full example for zlib.flush()
addaleax Apr 19, 2016
4b83769
doc: git mv to .md
eljefedelrodeodeljefe Apr 20, 2016
abd101b
http: disallow sending obviously invalid status codes
mscdex Apr 20, 2016
bad006f
zlib: fix use after null when calling .close
lightsofapollo Mar 31, 2016
4bfed26
test: add zlib close-after-error regression test
addaleax Apr 18, 2016
e43735b
2016-04-20, Version 5.11.0 (Stable) Release
Apr 20, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
console: check that stderr is writable
`Console` constructor checks that `stdout.write()` is a function but
does not do an equivalent check for `stderr.write()`. If `stderr` is not
specified in the constructor, then `stderr` is set to be `stdout`.
However, if `stderr` is specified, but `stderr.write()` is not a
function, then an exception is not thrown until `console.error()` is
called.

This change adds the same check for 'stderr' in the constructor that is
there for `stdout`. If `stderr` fails the check, then a `TypeError` is
thrown.

Took the opportunity to copyedit the `console` doc a little too.

PR-URL: #5635
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
Trott authored and evanlucas committed Mar 16, 2016
commit 5e9cac4333b7274d1354b86f44a43db374dac2f6
8 changes: 4 additions & 4 deletions doc/api/console.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ myConsole.warn(`Danger ${name}! Danger!`);
```

While the API for the `Console` class is designed fundamentally around the
Web browser `console` object, the `Console` in Node.js is *not* intended to
duplicate the browsers functionality exactly.
browser `console` object, the `Console` in Node.js is *not* intended to
duplicate the browser's functionality exactly.

## Asynchronous vs Synchronous Consoles

Expand All @@ -75,8 +75,8 @@ const Console = console.Console;

Creates a new `Console` by passing one or two writable stream instances.
`stdout` is a writable stream to print log or info output. `stderr`
is used for warning or error output. If `stderr` isn't passed, the warning
and error output will be sent to the `stdout`.
is used for warning or error output. If `stderr` isn't passed, warning and error
output will be sent to `stdout`.

```js
const output = fs.createWriteStream('./stdout.log');
Expand Down
3 changes: 3 additions & 0 deletions lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ function Console(stdout, stderr) {
}
if (!stderr) {
stderr = stdout;
} else if (typeof stderr.write !== 'function') {
throw new TypeError('Console expects writable stream instances');
}

var prop = {
writable: true,
enumerable: false,
Expand Down
19 changes: 13 additions & 6 deletions test/parallel/test-console-instance.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
'use strict';
require('../common');
var assert = require('assert');
var Stream = require('stream');
var Console = require('console').Console;
const assert = require('assert');
const Stream = require('stream');
const Console = require('console').Console;
var called = false;

const out = new Stream();
const err = new Stream();

// ensure the Console instance doesn't write to the
// process' "stdout" or "stderr" streams
process.stdout.write = process.stderr.write = function() {
Expand All @@ -20,9 +23,13 @@ assert.throws(function() {
new Console();
}, /Console expects a writable stream/);

var out = new Stream();
var err = new Stream();
out.writable = err.writable = true;
// Console constructor should throw if stderr exists but is not writable
assert.throws(function() {
out.write = function() {};
err.write = undefined;
new Console(out, err);
}, /Console expects writable stream instances/);

out.write = err.write = function(d) {};

var c = new Console(out, err);
Expand Down