lib/constants.js was incorrectly copying the constants from the
binding, by copying from `contants.os.errors` instead of
`constants.os.errno`.
PR-URL: https://github.com/nodejs/node/pull/9349
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Ron Korving <ron@ronkorving.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Fix incorrect use of string instead of RegExp in `throws` assertions.
PR-URL: https://github.com/nodejs/node/pull/9809
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* var -> const.
* Verify that callbacks are called with common.mustCall.
* Replace usage of deprecated `server.connections`.
* Use common.fail instead of rethrowing errors.
* Remove console.log statements.
* assert.equal -> assert.strictEqual.
* Correct order of arguments in assert.strictEqual.
PR-URL: https://github.com/nodejs/node/pull/9812
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* More precise length assertion.
* Fix incorrect use of string instead of RegExp in `throws` assertions.
* Add missing RegExp to `throws` assertions.
PR-URL: https://github.com/nodejs/node/pull/9811
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This reverts commit f2fe5583c4
(https://github.com/nodejs/node/pull/8169) as the original
justification for the runtime-deprecation does not appear
to justify the disruption to Node’s existing ecosystem.
Futhermore, the possibility of deprecating the Buffer constructor
entirely in v8.0 might lead to people having to change their code twice.
PR-URL: https://github.com/nodejs/node/pull/9529
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
* assert.equal -> assert.strictEqual.
* Fix incorrect use of string instead of RegExp in `throws` assertions.
PR-URL: https://github.com/nodejs/node/pull/9808
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
There is no guarantee that a dgram packet will be received. The test is
currently written to only send exactly as many dgram packets as required
assuming they are all received. As a result, failures like this may
occur (from CI):
```
not ok 719 parallel/test-cluster-dgram-2
---
duration_ms: 120.39
severity: fail
stack: |-
timeout
```
This change has the workers send packets continuously until disconnect.
PR-URL: https://github.com/nodejs/node/pull/9791
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Use port 0 instead of common.PORT.
PR-URL: https://github.com/nodejs/node/pull/9573
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Use port 0 instead of common.PORT, and use server address
instead of localhost to follow writing test guideline.
This is a part of Code And Learn at NodeFest 2016 Challenge in Tokyo.
PR-URL: https://github.com/nodejs/node/pull/9572
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Reviewed-By: James M Snell <jasnell@gmail.com>
* assert.equal() -> assert.strictEqual()
* regex -> .include()
* Change variable representing a function from `fun` to idiomatic `fn`
* var -> const
PR-URL: https://github.com/nodejs/node/pull/9780
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
This reverts commit ca37fa527f.
A test provided by the commit fails on most (but not all) platforms on
CI.
PR-URL: https://github.com/nodejs/node/pull/9814
Ref: https://github.com/nodejs/node/pull/9492
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
As per ecma-262 2015's #sec-%typedarray%-buffer-byteoffset-length,
`offset` would be an integer, not a 32 bit unsigned integer. Also,
`length` would be an integer with the maximum value of 2^53 - 1, not a
32 bit unsigned integer.
This would be a problem because, if we create a buffer from an
arraybuffer, from an offset which is greater than 2^32, it would be
actually pointing to a different location in arraybuffer. For example,
if we use 2^40 as offset, then the actual value used will be 0,
because `byteOffset >>>= 0` will convert `byteOffset` to a 32 bit
unsigned int, which is based on 2^32 modulo.
PR-URL: https://github.com/nodejs/node/pull/9492
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Make /json/version return an object instead of an object wrapped in an
array.
Fixes: https://github.com/nodejs/node/issues/9760
PR-URL: https://github.com/nodejs/node/pull/9762
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
pseudo-tty/no_interleaved_stdio has hung a few times
in the last couple of days on AIX. We believe
it is not a Node.js issue but an issue with python
on AIX. Its being investigated under:
https://github.com/nodejs/node/issues/7973.
Excluding this additional test until we can
resolve the python issue.
Fixes https://github.com/nodejs/node/issues/9765
PR-URL: https://github.com/nodejs/node/pull/9772
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
* Liberal use of common.mustCall()
* Rename test-dgram-empty-packet -> test-dgram-send-empty-packet
* Remove use of timers to avoid CI failures like seen in the Ref below:
```
not ok 237 parallel/test-dgram-empty-packet
---
duration_ms: 0.717
severity: fail
stack: |-
...
throw new Error('Timeout');
^
Error: Timeout
at Timeout._onTimeout
...
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
```
Refs: https://ci.nodejs.org/job/node-test-commit-freebsd/5341/nodes=freebsd11-x64/console:
PR-URL: https://github.com/nodejs/node/pull/9724
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
In closed environments, self-signed or privately signed certificates are
commonly used, and rejected by Node.js since their root CAs are not
well-known. Allow extending the set of well-known compiled-in CAs via
environment, so they can be set as a matter of policy.
PR-URL: https://github.com/nodejs/node/pull/9139
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
* setTimeout() with no duration -> setImmediate()
* add common.mustCall() where appropriate
* var -> const
* .on() -> .once()
PR-URL: https://github.com/nodejs/node/pull/9715
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
markdown had a dispensation because 2 or more trailing spaces triggers a
new paragraph. There are no examples of that usage in Node, all trailing
whitespace found were mistakes, and the dispensation is now removed.
See: https://github.com/nodejs/node/pull/9620
PR-URL: https://github.com/nodejs/node/pull/9676
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
* `assert.equal()` -> `assert.strictEqual()`
* add duration to `setTimeout()`
PR-URL: https://github.com/nodejs/node/pull/9663
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
src: Add does_zap_garbage, malloced_memory and
peak_malloced_memory to v8 HeapStatistics
Following https://github.com/nodejs/code-and-learn/issues/56 I
have exposed does_zap_garbage to HeapStatistics.
The other fields, malloced_memory and peak_malloced_memory don't
seem to be in the current version of v8 in master.
PR-URL: https://github.com/nodejs/node/pull/8610
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1aa595e5bd introduced a `throw` for accessing `Symbol` properties of
`process.env`. However, this breaks `util.inspect(process)` and
things like `Object.prototype.toString.call(process.env)`, so this
patch changes the behaviour for the getter to just always return
`undefined`.
Ref: https://github.com/nodejs/node/pull/9446
Fixes: https://github.com/nodejs/node/issues/9641
PR-URL: https://github.com/nodejs/node/pull/9631
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Allow method chaining as with setAutoPadding and other methods.
PR-URL: https://github.com/nodejs/node/pull/9398
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Make cctest valgrind-clean again by freeing heap-allocated memory.
Overlooked in commit ea94086 ("src: provide allocation + nullptr check
shortcuts.")
PR-URL: https://github.com/nodejs/node/pull/9667
Refs: https://github.com/nodejs/node/pull/8482
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Currently if the os.cpus() call fails every test will fail. As there is
already a test for os.cpus(), the other tests should run even if the
os.cpus() call fails.
PR-URL: https://github.com/nodejs/node/pull/9616
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
use setImmediate() insted of setTimeout()
in test of stream2 push.
The test is in test/parallel/test-stream2-push.js
Fixes: https://github.com/nodejs/code-and-learn/issues/58
PR-URL: https://github.com/nodejs/node/pull/9583
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
This commit adds the test case of PassThrough.
This test case checks that PassThrough can
construct without new operator.
This is a part of Code And Learn at NodeFest 2016
Fixes: https://github.com/nodejs/code-and-learn/issues/58
PR-URL: https://github.com/nodejs/node/pull/9581
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
This test is only here to ensure consistent cross-platform behaviour.
PR-URL: https://github.com/nodejs/node/pull/9229
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
When both --debug-brk and --eval are set, and a filename is
specified, its full path is not set correctly, causing an error
for relative filenames with './' omitted.
For example, 'node --debug-brk -e 0 hello.js' throws an error.
Since the script referenced by the filename is never run anyway,
this change skips resolving its full path if both --debug-brk and
--eval are set.
PR-URL: https://github.com/nodejs/node/pull/8876
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit adds a test for the scenario where a child process is
spawned, but the stdio streams could not be created.
PR-URL: https://github.com/nodejs/node/pull/9528
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Writing data to TLSWrap instance during handshake will result in it
being queued in `write_item_queue_`. This queue won't get cleared up
until the end of the handshake.
Technically, it gets cleared on `~TLSWrap` invocation, however this
won't ever happen because every `WriteWrap` holds a reference to the
`TLSWrap` through JS object, meaning that they are doomed to be alive
for eternity.
To breach this dreadful contract a knight shall embark from the
`close` function to kill the dragon of memory leak with his magic
spear of `destroySSL`.
`destroySSL` cleans up `write_item_queue_` and frees `SSL` structure,
both are good for memory usage.
PR-URL: https://github.com/nodejs/node/pull/9586
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Previously our tests did not check this codepath as seen at
coverage.nodejs.org
PR-URL: https://github.com/nodejs/node/pull/9555
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Previously our tests did not check these codepaths as seen at
coverage.nodejs.org
PR-URL: https://github.com/nodejs/node/pull/9556
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
* minor layout changes for clarity
* assert.equal() and assert.ok() swapped out for assert.strictEqual()
* var -> const for modules included via require()
PR-URL: https://github.com/nodejs/node/pull/9544
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This is a part of Code And Learn at NodeFest 2016 Challenge
Fixes: https://github.com/nodejs/code-and-learn/issues/58
PR-URL: https://github.com/nodejs/node/pull/9578
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit improves the test cases in
test-stream2-objects.js by using assert.strictEqual
instead of assert.equal.
This is a part of Code And Learn at NodeFest 2016
Fixes: https://github.com/nodejs/code-and-learn/issues/58
PR-URL: https://github.com/nodejs/node/pull/9565
Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
The tick-processor tests are inherently non-deterministic. They
therefore have false negatives from time to time. They also
sometimes leave extra processes running.
Move them to their own directory until these issues are sorted. Note
that this means that the tests will not be run in CI. Like the inspector
tests and other tests, they will have to be run manually when they are
wanted.
PR-URL: https://github.com/nodejs/node/pull/9506
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Matthew Loring <mattloring@google.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
There are two instances of `setTimeout()` called without a duration in
`inspector-helper.js`. Change to `setImmediate()` for clarity that it
isn't a mistake.
PR-URL: https://github.com/nodejs/node/pull/9499
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Move copy/pasted callback into its own function.
PR-URL: https://github.com/nodejs/node/pull/9498
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>