Dan Kaplun
6ead99aa73
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-27 16:07:53 +02:00
Rich Trott
419e88ea4a
lib,test: lint fixes for linter upgrade
...
ESLint 4.19.1 fixes some bugs in rules. These changes prepare us for the
upgrade.
PR-URL: https://github.com/nodejs/node/pull/19528
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-27 16:00:57 +02:00
Brian White
f13cc3237e
stream: improve stream creation performance
...
PR-URL: https://github.com/nodejs/node/pull/19401
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-03-27 15:53:05 +02:00
Hannes Magnusson
23312675cb
crypto: provide full cert details to checkServerIdentity
...
PR-URL: https://github.com/nodejs/node/pull/17690
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-24 20:27:09 +01:00
Michaël Zasso
40916a27bc
path: fix regression in posix.normalize
...
Fixes a regression introduced in [1].
The posix version of normalize should not treat backslash as a path
separator.
[1] https://github.com/nodejs/node/commit/4ae320f2
PR-URL: https://github.com/nodejs/node/pull/19520
Fixes: https://github.com/nodejs/node/issues/19519
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-24 17:53:36 +01:00
James M Snell
49c0efd2a2
http2: remove some unnecessary next ticks
...
PR-URL: https://github.com/nodejs/node/pull/19451
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-03-24 17:52:34 +01:00
Tobias Nießen
b351e0eda6
http: use more destructuring
...
PR-URL: https://github.com/nodejs/node/pull/19481
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-03-24 17:52:26 +01:00
Sameer Srivastava
926214aefe
cluster: add support for NODE_OPTIONS="--inspect"
...
When using cluster and --inspect as cli argument it is correctly
handled and each worker will use a different port, this was
fixed by #13619 . But when env var NODE_OPTIONS="--inspect"
is set this logic doesn't apply and the workers will fail as they
try to attach to the same port.
Fixes: https://github.com/nodejs/node/issues/19026
PR-URL: https://github.com/nodejs/node/pull/19165
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2018-03-24 11:42:37 +01:00
Matteo Collina
3914e97741
http2: fixes error handling
...
There should be no default error handling when using Http2Stream.
All errors will end up in `'streamError'` on the server anyway,
but they are emitted on `'stream'` as well, otherwise some error
conditions are impossible to debug.
See: https://github.com/nodejs/node/pull/14991
Backport-PR-URL: https://github.com/nodejs/node/pull/19478
PR-URL: https://github.com/nodejs/node/pull/19232
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-21 11:04:46 +00:00
Ruben Bridgewater
55f7bbb0bd
repl: refactor code for readability
...
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/17919
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Lance Ball <lball@redhat.com >
2018-03-21 10:50:36 +00:00
Ruben Bridgewater
6997af7378
repl: upper case comments first char
...
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/17919
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Lance Ball <lball@redhat.com >
2018-03-21 10:50:33 +00:00
Ruben Bridgewater
f4f0266bfe
errors: add comments about falsy error types
...
Some error types are not properly set. This adds comments which
ones are probably falty and to what they should be set instead.
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/18857
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-21 10:50:31 +00:00
Ruben Bridgewater
07845fc19e
console: port errors to new system
...
This ports the errors to the new error system.
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/18857
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-21 10:50:28 +00:00
Ruben Bridgewater
ffa16aad60
errors: update all internal errors
...
This updates all internal errors to the new error type. While doing
so it removes unused errors.
A few errors currently seem to have the wrong type. To identify them
later, comments were added next to the error type.
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/18857
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-21 10:50:26 +00:00
Ruben Bridgewater
d57a2421fc
errors: implement new error handling
...
This implements a function based system. Instead of passing in the
error code as first argument, the error code itself is a error class.
It already contains the correct error type, so while adding a new
error no one has to think about the error type anymore. In case a
single error code has more than one error type, the error class has
properties for the non default error types. Those can be used as
fallback.
This prevents typos, makes the implementation easier and it is less
verbose when writing the code for a new error.
The implementation itself does not interfere with the old
implementation. So the old and the new system can co-exist and it is
possible to slowly migrate the old ones to the new system.
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/18857
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-21 10:50:22 +00:00
Ruben Bridgewater
9d1e409ee3
tools: enable no-unsafe-finally
...
This enables the `no-unsafe-finally` eslint rule to make sure we
have a proper control flow in try / catch.
Backport-PR-URL: https://github.com/nodejs/node/pull/19244
PR-URL: https://github.com/nodejs/node/pull/18745
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-21 10:50:09 +00:00
Sarat Addepalli
607b33cfcc
fs: support as and as+ flags in stringToFlags()
...
PR-URL: https://github.com/nodejs/node/pull/18801
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matheus Marchini <matheus@sthima.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-20 12:04:09 +00:00
Trivikram
519850f21e
test: http2 client setNextStreamID errors
...
Backport-PR-URL: https://github.com/nodejs/node/pull/18848
PR-URL: https://github.com/nodejs/node/pull/18848
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:49:43 +00:00
Daniel Bevenius
f0f31d080a
async_hooks: add copyHooks function
...
This commit introduces a copyHooks function that can be used by
storeActiveHooks and restoreActiveHooks to remove some code duplication.
PR-URL: https://github.com/nodejs/node/pull/19391
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-03-20 11:49:42 +00:00
Sergey Golovin
072adfea8c
url: replace "magic" numbers by constants
...
PR-URL: https://github.com/nodejs/node/pull/19035
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-03-20 11:49:37 +00:00
Sergey Golovin
a9bd8bff8a
path: remove redundant function
...
PR-URL: https://github.com/nodejs/node/pull/19237
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2018-03-20 11:34:04 +00:00
cjihrig
f06622cd56
lib: define printErr() in script string
...
This commit moves the printErr() function, used by the
tick profiler processer, into the code string passed to
vm.runInThisContext().
PR-URL: https://github.com/nodejs/node/pull/19285
Fixes: https://github.com/nodejs/node/issues/19260
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-20 11:34:00 +00:00
Anton Salikhmetov
060216689a
tls: expose Finished messages in TLSSocket
...
Exposes SSL_get_finished and SSL_get_peer_finished routines in OpenSSL
as tlsSocket.getFinished and tlsSocket.getPeerFinished, respectively.
PR-URL: https://github.com/nodejs/node/pull/19102
Fixes: https://github.com/nodejs/node/issues/19055
Refs: https://github.com/ripple/rippled/issues/2413
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:33:58 +00:00
Daniel Bevenius
71b1c7f79f
async_hooks: don't set hook_fields[kTotals] to 0
...
This commit removes the setting of hook_field[kTotals] to szero in
AsyncHook's enable function.
As far as I can tell this would not be required if the setting of
this field is done with the assignment operator instead of using the
addition assignment operator.
PR-URL: https://github.com/nodejs/node/pull/19219
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:33:57 +00:00
Prince J Wesley
3e6858e4a7
repl: better handling of recoverable errors
...
Below syntax errors are handled without force .break/clear
- Unexpected Token (prefix errors)
- missing ) after argument list
In the multiline expression, recoverable errors are truly
recoverable, otherwise syntax error will be thrown.
PR-URL: https://github.com/nodejs/node/pull/18915
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-20 11:33:54 +00:00
Gus Caplan
9613e02ff7
tools,bootstrap: preprocess gypi files to json
...
PR-URL: https://github.com/nodejs/node/pull/19140
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-20 11:33:52 +00:00
Rich Trott
563bed00f5
benchmark,lib,test,tools: use consistent quotes
...
In preparation for a linting rule, use consistent quotation for
properties in objects.
PR-URL: https://github.com/nodejs/node/pull/19156
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Roman Reiss <me@silverwind.io >
2018-03-20 11:33:44 +00:00
Luigi Pinca
5b12d3a58e
net: do not inherit the no-half-open enforcer
...
`Socket.prototype.destroySoon()` is called as soon as `UV_EOF` is read
if the `allowHalfOpen` option is disabled. This already works as a
"no-half-open enforcer" so there is no need to inherit another from
`stream.Duplex`.
PR-URL: https://github.com/nodejs/node/pull/18974
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chen Gang <gangc.cxy@foxmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-20 11:33:42 +00:00
Luigi Pinca
152c931f53
stream: make Duplex inherits from DuplexBase
...
Add ability to subclass `stream.Duplex` without inheriting the
"no-half-open enforcer" regardless of the value of the `allowHalfOpen`
option.
PR-URL: https://github.com/nodejs/node/pull/18974
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chen Gang <gangc.cxy@foxmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-20 11:33:42 +00:00
Ruben Bridgewater
8d33e5c214
assert: improve error check
...
Minor performance improvement.
PR-URL: https://github.com/nodejs/node/pull/17574
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-03-20 11:33:41 +00:00
Luigi Pinca
9c0c0e68ac
stream: add no-half-open enforcer only if needed
...
The listener does not do anything if `allowHalfOpen` is enabled. Add it
only when `allowHalfOpen` is disabled.
PR-URL: https://github.com/nodejs/node/pull/18953
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:33:40 +00:00
Anna Henningsen
b01bd800c6
fs: fix createReadStream(…, {end: n}) for non-seekable fds
...
82bdf8fba2 fixed an issue by silently modifying the `start`
option for the case when only `end` is passed, in order to perform
reads from a specified range in the file.
However, that approach does not work for non-seekable files, since
a numeric `start` option means that positioned reads will be used
to read data from the file.
This patch fixes that, and instead ends reading after a specified
size by adjusting the read buffer size.
This way we avoid re-introducing the bug that 82bdf8fba2 fixed,
and align behaviour with the native file stream mechanism
introduced in https://github.com/nodejs/node/pull/18936 as well.
PR-URL: https://github.com/nodejs/node/pull/19329
Fixes: https://github.com/nodejs/node/issues/19240
Refs: https://github.com/nodejs/node/pull/18121
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chen Gang <gangc.cxy@foxmail.com >
2018-03-20 11:33:40 +00:00
Ruben Bridgewater
5e6b42ec9c
assert: show proper differences
...
Right now it is possible to get an AssertionError from input that has
the customInspect function set to always return the same value.
That way the error message is actually misleading because the output
is going to look the same. This fixes it by deactivating the custom
inspect function.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/18611
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-20 11:33:39 +00:00
Ruben Bridgewater
9abbb6b857
assert: fix infinite loop
...
In rare cirumstances it is possible to get a identical error diff.
In such a case the advances diffing runs into a infinite loop.
This fixes it by properly checking for extra entries.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/18611
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-20 11:33:39 +00:00
Ruben Bridgewater
e9ac468146
assert: fix throws trace
...
The current stack trace thrown in case `assert.throws(fn, object)`
is used did not filter the stack trace. This fixes it.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/18595
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-03-20 11:33:38 +00:00
Ruben Bridgewater
d3c2534bbe
assert: use destructuring for errors
...
Destructure the necessary Error classes from internal/errors.
This improves the readability of the error creation.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/18247
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:33:38 +00:00
Ruben Bridgewater
74f0d1aa60
tty: refactor to es6
...
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17615
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-03-20 11:33:37 +00:00
Ruben Bridgewater
ead727c274
tty: add getColorDepth function
...
Right now it is very difficult to determine if a terminal supports
colors or not. This function adds this functionality by detecting
environment variables and checking process.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17615
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-03-20 11:33:37 +00:00
Ruben Bridgewater
5aa3a2d172
assert: improve error messages
...
From now on all error messages produced by `assert` in strict mode
will produce a error diff.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17615
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-03-20 11:33:36 +00:00
Ruben Bridgewater
c18ac52970
util: add util.inspect compact option
...
The current default formatting is not ideal and this improves
the situation by formatting the output more intuitiv.
1) All object keys are now indented by 2 characters instead of
sometimes 2 and sometimes 3 characters.
2) Each object key will now use an individual line instead of
sharing a line potentially with multiple object keys.
3) Long strings will now be split into multiple lines in case
they exceed the "lineBreak" option length (including the
current indentation).
4) Opening braces are now directly behind a object property
instead of using a new line.
5) Switch inspect "base" order. In case the compact option is set
to `false`, inspect will now print
"[Function: foo] {\n property: 'data'\n}"
instead of
"{ [Function: foo]\n property: 'data'\n}".
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17576
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-20 11:33:36 +00:00
Ruben Bridgewater
ce3a5af69f
util: rename util.inspect argument
...
util.inspect can actually receive any property and the description
was wrong so far. This fixes it by renaming the argument to
value and also updating the description.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17576
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-20 11:33:36 +00:00
Ben Noordhuis
b35eabb837
lib: handle throw undefined in assert.throws()
...
And make `assert.doesNotThrow()` handle it as well.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/18029
Fixes: https://github.com/nodejs/node/issues/18027
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:33:35 +00:00
Ruben Bridgewater
f96ea47cf5
assert: fix strict regression
...
Using `assert()` or `assert.ok()` resulted in a error since a
refactoring.
Refs: https://github.com/nodejs/node/pull/17582
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17903
Refs: https://github.com/nodejs/node/pull/17582
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:33:34 +00:00
Ruben Bridgewater
ebd60fa505
assert: .throws accept objects
...
From now on it is possible to use a validation object in throws
instead of the other possibilites.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17584
Refs: https://github.com/nodejs/node/pull/17557
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ron Korving <ron@ronkorving.nl >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
2018-03-20 11:33:34 +00:00
Ruben Bridgewater
612ba1a3f0
assert: improve assert.throws
...
Throw a TypeError in case a error message is provided in the second
argument and a third argument is present as well.
This is clearly a mistake and should not be done.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17585
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2018-03-20 11:33:33 +00:00
Ruben Bridgewater
24aeca7dd5
assert: fix throws and doesNotThrow stack frames
...
The stack frames from .throws and .doesNotThrow got included
even though that was not intended.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17703
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-20 11:33:32 +00:00
Ruben Bridgewater
db73d1c13b
assert: use object argument in innerFail
...
Right now it is difficult to know what argument stands for what
property. By refactoring the arguments into a object it is clear
what stands for what.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17582
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
2018-03-20 11:33:32 +00:00
Ruben Bridgewater
bae5de1949
assert: add strict functionality export
...
Requireing the strict version will allow to use `assert.equal`,
`assert.deepEqual` and there negated counterparts to be used with
strict comparison instead of using e.g. `assert.strictEqual`.
The API is identical to the regular assert export and only differs
in the way that all functions use strict compairson.
Backport-PR-URL: https://github.com/nodejs/node/pull/19230
PR-URL: https://github.com/nodejs/node/pull/17002
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-20 11:33:32 +00:00
Anna Henningsen
ef4714c2b6
net: inline and simplify onSocketEnd
...
Backport-PR-URL: https://github.com/nodejs/node/pull/19194
PR-URL: https://github.com/nodejs/node/pull/18607
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-03-07 09:36:52 -08:00
Gus Caplan
3e8e1524ac
util: use blue on non-windows systems for number
...
Backport-PR-URL: https://github.com/nodejs/node/pull/19180
PR-URL: https://github.com/nodejs/node/pull/18925
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-07 09:35:03 -08:00