Specify more configuration options to reduce run time by about a third.
PR-URL: https://github.com/nodejs/node/pull/14180
Fixes: https://github.com/nodejs/node/issues/14177
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Set configuration option to reduce combinations of benchmark settings
tried in test, reducing execution time by about 50%.
PR-URL: https://github.com/nodejs/node/pull/14183
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Because of a race condition, connection listener may not be invoked if
test is run under load. Remove `common.mustCall()` wrapper from the
listener. Move the test to `parallel` because it now works under load.
Make similar change to http test to keep them in synch even though it is
much harder to trigger the race in http.
PR-URL: https://github.com/nodejs/node/pull/14134
Fixes: https://github.com/nodejs/node/issues/14133
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
The sequential/test-regress-GH-4027 test is flaky with an increased
system load, failing when the watched file is unlinked before the
first state of the watched file is retrieved.
After increasing the delay before unlinking and calling setTimeout
after watchFile, the flakiness stopped reproducing.
PR-URL: https://github.com/nodejs/node/pull/14010
Fixes: https://github.com/nodejs/node/issues/13800
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
* Make changes to `test-https-set-timeout-server` to resolve
inconsistencies with its http counterpart:
- Apply the changes analogous to those in GH-13802 to the https test.
- Add a missing `common.mustCall()` wrapper.
- Make small stylistic changes (e.g., remove unnecessary line breaks
in comments) to make it visually consistent with the http test.
* Use arrow functions.
PR-URL: https://github.com/nodejs/node/pull/13935
Fixes: https://github.com/nodejs/node/issues/13588
Refs: https://github.com/nodejs/node/pull/13802
Refs: https://github.com/nodejs/node/pull/13625
Refs: https://github.com/nodejs/node/pull/13822
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Make test-http(s)-set-timeout-server tests more similar and resolve the
following issues:
* `test-https-set-timeout-server.js` was missing some `assert`
statements, including with `http` module
* Both files were missing some calls to `common.mustCall()`
* Both files were calling `createServer()` in different ways
PR-URL: https://github.com/nodejs/node/pull/13822
Refs: https://github.com/nodejs/node/issues/13588
Refs: https://github.com/nodejs/node/pull/13625
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Previous realization produces some false positive and false negative
results due to:
* conflicts between unescaped user input and RegExp special characters;
* conflicts between parsing with `\b` RegExp symbol and non
alphanumeric characters in section names.
The doc does not mention any such restrictions.
PR-URL: https://github.com/nodejs/node/pull/13841
Fixes: https://github.com/nodejs/node/issues/13728
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
* Remove needless RegExp flag
In fixed case, `/g` flag is needless in the boolean context.
* Remove needless RegExp capturing
Use non-capturing grouping or remove capturing completely when:
* capturing is useless per se, e.g. in test() check;
* captured groups are not used afterward at all;
* some of the later captured groups are not used afterward.
* Use test, not match/exec in boolean context
match() and exec() return a complicated object,
unneeded in a boolean context.
* Do not needlessly repeat RegExp creation
This commit takes RegExp creation out of cycles and other repetitions.
As long as the RegExp does not use /g flag and match indices,
we are safe here.
In tests, this fix hardly gives a significant performance gain,
but it increases clarity and maintainability,
reassuring some RegExps to be identical.
RegExp in functions are not taken out of their functions:
while these functions are called many times
and their RegExps are recreated with each call,
the performance gain in test cases
does not seem to be worth decreasing function self-dependency.
PR-URL: https://github.com/nodejs/node/pull/13770
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Make test-http(s)-set-timeout-server tests more similar and resolve the
following issues:
* `test-http-set-timeout-server.js` had a `secReceived` check in
`serverResponseTimeoutWithPipeline()` that was added to prevent
flakiness, but this did not exist in the https counterpart.
* `test-https-set-timeout-server.js` utilized `common.mustCall()`,
`common.mustNotCall()`, etc., while the http counterpart utilized the
old method of checking flags on exit of the process.
Refs: https://github.com/nodejs/node/issues/13588
PR-URL: https://github.com/nodejs/node/pull/13625
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Use common.mustNotCall() in test/sequential/test-fs-watch.js in
situations where the call to watch() is expected to throw.
PR-URL: https://github.com/nodejs/node/pull/13595
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Allows NODE_TEST_DIR to be set (necessary to avoid path length issues
with common.PIPE).
PR-URL: https://github.com/nodejs/node/pull/13390
Refs: https://github.com/nodejs/node/issues/12708#issuecomment-297847882
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* Use common.mustNotCall() and common.mustCall() as appropriate
* Use block scoping
* Move assertions out of `exit` handler and into callbacks
* Order assert.strictEqual() args per docs
* Remove console.log() calls
* Move test from `parallel` to `sequential` so `common.PORT` can be used
without conflicting with OS-provided ports in other `parallel` tests
PR-URL: https://github.com/nodejs/node/pull/13273
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
When a no-op message event handler is used in a test, make it clear what
is expected by using `common.mustCall()` and `common.mustNotCall()`.
PR-URL: https://github.com/nodejs/node/pull/13125
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <mhdawson@ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Fixed sequential test-net-connect-local-error by swapping port
and localPort in net.connect options.
PR-URL: https://github.com/nodejs/node/pull/13064
Fixes: https://github.com/nodejs/node/issues/13055
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Add `--set key=""` to cut down the time it takes to run
test-benchmark-http by about a third.
Alphabetize options in `--set` list.
PR-URL: https://github.com/nodejs/node/pull/13109
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
The usage of common.PORT could cause undesired port collisions when run
in parallel. The following test was moved to sequential.
test-net-reconnect-error.js
PR-URL: https://github.com/nodejs/node/pull/13033
Refs: https://github.com/nodejs/node/issues/12376
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Use `common.mustCall()` and `common.mustNotCall()` to check that
callbacks are invoked the expected number of times in
test-net-listen-shared-ports.
PR-URL: https://github.com/nodejs/node/pull/13010
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Remove common.PORT from, test-net-connect-immediate-destroy,
test-net-options-lookup, test-net-connect-local-error,
test-net-connect-handle-econnrefused, test-net-socket-destroy-twice,
test-net-better-error-messages-port-hostname, test-net-localerror,
to reduce possibility that a dynamic port used in another test will
collide with common.PORT.
Moved test-net-listen-shared-ports, test-net-better-error-messages-port
from tests/parallel to test/sequential
Refs: https://github.com/nodejs/node/issues/12376
PR-URL: https://github.com/nodejs/node/pull/12473
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This is first in a hoped-for series of moves away from a monolithic
common.js that is loaded for every test and towards a more modular
approach. (In the end, common.js will hopefully contain checks for
variables leaking into the global space and perhaps some of the more
ubiquitous functions like common.mustCall().)
Move the WPT testing code to its own module.
PR-URL: https://github.com/nodejs/node/pull/12736
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Use block scope for local variables only used in a small code block.
Fixed inverse arguments in some usages of Assert.strictEqual.
PR-URL: https://github.com/nodejs/node/pull/12728
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
When configured --without-ssl the inspect-brk option will not be
available and the process will exit with a exit value of 9 "Invalid
Argument/Bad option".
This commit adds a skipIfInspectorDisabled check since --without-ssl
implies that no inspector support is build as well.
PR-URL: https://github.com/nodejs/node/pull/12757
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
test-https-set-timeout-server fails under load. Move it to sequential so
it is not competing with other tests.
PR-URL: https://github.com/nodejs/node/pull/12704
Fixes: https://github.com/nodejs/node/issues/10130
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
test-benchmark-child-process failures reveal that
child-process-exec-stdout benchmark sometimes leaves around a stray
yes.exe process. Add code to terminate the process.
PR-URL: https://github.com/nodejs/node/pull/12658
Ref: https://github.com/nodejs/node/issues/12560
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/12622
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reversed "actual" and "expected" arguments for assert.strictEqual().
Replaced constructor with regular expression for assert.throws().
PR-URL: https://github.com/nodejs/node/pull/12595
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
https://github.com/nodejs/node/issues/5085 has been completed so
presumably test-fs-watch is not flaky on AIX anymore. Remove flaky
designation from sequential.status.
PR-URL: https://github.com/nodejs/node/pull/12564
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/12470
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
sequential/test-benchmark-child-process is still failing sometimes flaky
on Windows in CI. Mark it as flaky in sequential.status until it gets
sorted.
PR-URL: https://github.com/nodejs/node/pull/12561
Ref: https://github.com/nodejs/node/issues/12560
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
test-benchmark-child-process sometimes times out on Windows in CI.
Minimize the number of configurations that run so it will (hopefully)
not time out anymore. Set dur=0.
PR-URL: https://github.com/nodejs/node/pull/12518
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
In the 2017-04-05 meeting, the CTC agreed to remove support for the
legacy debugger in 8.0.0. This is the first step in this direction.
Refs: https://github.com/nodejs/CTC/issues/94
PR-URL: https://github.com/nodejs/node/pull/12197
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@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>
This test is allocating much more memory than necessary to actually
reproduce the original problem. Lowering the amount of memory allocated
increases performance at least in some cases and makes this test less
likely to time out on SmartOS.
PR-URL: https://github.com/nodejs/node/pull/11177
Ref: https://github.com/nodejs/node/issues/10166
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Julien Gilli <jgilli@nodejs.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Export a new common.noop no-operation function for general use.
Allow using common.mustCall() without a fn argument to simplify
test cases.
Replace various non-op functions throughout tests with common.noop
PR-URL: https://github.com/nodejs/node/pull/12027
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Currently, benchmark code is not exercised at all in CI. This adds a
minimal test for net benchmarks. If this is deemed acceptable, similar
minimal tests for other benchmarks can be written. Additionally, as
issues and edge cases are uncovered, checks for them can be added.
PR-URL: https://github.com/nodejs/node/pull/11979
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
test-domain-abort-on-uncaught is flaky under load. Move it to sequential
so it is not competing with other tests for resources.
PR-URL: https://github.com/nodejs/node/pull/11817
Fixes: https://github.com/nodejs/node/issues/11814
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Currently when node is build --without-ssl and the test are run,
there are a number of failing test due to tests expecting crypto
support to be available. This commit fixes fixes the failure and
instead skips the tests that expect crypto to be available.
PR-URL: https://github.com/nodejs/node/pull/11631
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The intention of test case is to make sure that `timeout` property is honored
and the code in context terminates and throws correct exception. However in
test case, the code inside context would complete before `timeout` for windows
and would sometimes fail. Updated the code so it guarantee to not complete
execution until timeout is triggered.
Fixes: https://github.com/nodejs/node/issues/11261
PR-URL: https://github.com/nodejs/node/pull/11530
Reviewed-By: James M Snell <jasnell.gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
This commit adds a mustNotCall() helper for testing. This provides
an alternative to using common.fail() as a callback, or creating
a callback function for the sole purpose of calling common.fail().
PR-URL: https://github.com/nodejs/node/pull/11152
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Even after being moved to `sequential` in
1ce05ad540, `test-regress-GH-897` still
was occasionally flaky on Raspberry Pi devices on CI.
The test is especially sensitive to resource constraints. It failed
reliably on my laptop if I moved it to `parallel` and ran 32 competing
node test processes. Even for a flaky test, that's unusually low. I
typically don't see problems, even for flaky tests, until I get up to
around four times that number.
On a Raspberry Pi, of course, that sensitivity to resource constraints
will manifest much sooner.
This change checks the order of timers firing, rather than the duration
before a timer is fired. This eliminates the sensitivity to resource
constraints. The test can now be moved back to `parallel`. I am able to
run many copies of the test simultaneously without seeing test failures.
PR-URL: https://github.com/nodejs/node/pull/10903
Fixes: https://github.com/nodejs/node/issues/10073
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
test-fs-readfile-tostring-fail is resource-intensive and is flaky in
CI. Move to sequential tests so it is not competing for resources with
other tests.
PR-URL: https://github.com/nodejs/node/pull/10744
Fixes: https://github.com/nodejs/node/issues/10742
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Use assert.strictEqual instead of assert.equal in tests, manually
convert types where necessary.
PR-URL: https://github.com/nodejs/node/pull/10698
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Manually fix issues that eslint --fix couldn't do automatically.
PR-URL: https://github.com/nodejs/node/pull/10685
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Formatting changes for upcoming linter update.
PR-URL: https://github.com/nodejs/node/pull/10561
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
* use const and let instead of var
* use assert.strictEqual instead of assert.equal
* use arrow functions
* removed unwanted console log
PR-URL: https://github.com/nodejs/node/pull/10531
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
add an --inspect-brk option which breaks on
first line of user script. same behavior as old
--debug-brk flag.
PR-URL: https://github.com/nodejs/node/pull/8979
Reviewed-By: Eugene Ostroukhov <eostroukhov@chromium.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
test-http-client-timeout-with-data has failed here and there in CI on
FreeBSD and OS X. The test has a socket timeout set to 50ms and a timer
set for 100ms. However, they are not necessarily set in the same tick of
the event loop and their ordering is therefore not guaranteed.
Instead of using a timer, this change listens for an event on the
listener to know when the socket timeout has occurred and then runs the
code originally in the timer.
Additional refactoring: Replaced `process.on('exit', ...)` checks with
`common.mustCall()` and replaced usage of `assert.equal()` with
`assert.strictEqual()`.
PR-URL: https://github.com/nodejs/node/pull/10431
Reviewed-By: James M Snell <jasnell@gmail.com>
* use const and let instead of var
* use common.mustCall to control functions executions
* use assert.strictEqual instead of assert.equal
* use assert.ifError to handle errors
* use arrow functions
* remove console.log and process.stdout.write
PR-URL: https://github.com/nodejs/node/pull/10452
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
1. Lot of repeating code has been refactored to a function
2. Errors in async calls are properly asserted
3. Fail the test if the callbacks are not fired
PR-URL: https://github.com/nodejs/node/pull/10384
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Julian Duque <julianduquej@gmail.com>
* used let and const instead of var
* used assert.strictEqual instead assert.equal
PR-URL: https://github.com/nodejs/node/pull/10357
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Julian Duque <julianduquej@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
test-timers-same-timeout-wrong-list-deleted was flaky under load because
there is no guarantee that a timer will fire within a given period of
time. It had an exit handler that checked that the process was finishing
in less than twice as much as a timer was set for. Under load, the
timer could take over 200ms to fire even if it was set for 100ms, so
this was causing the test to be flaky on CI from time to time.
However, that timing check is unnecessary to identify the regression
that the test was written for. When run with a version of Node.js that
does not contain the fix that accompanied the test in its initial
commit, an assertion indicating that there were still timers in the
active timer list fired. So, this commit removes the exit handler timing
check and relies on the existing robust active timers list length check.
This allows us to move the test back to parallel because it does not
seem to fail under load anymore.
The test was refactored slightly, removing duplicated code to a
function, using `assert.strictEqual()` instead of `assert.equal()`,
changing a 10ms timer to 1ms, and improving the messages provided by
assertions.
Fixes: https://github.com/nodejs/node/issues/8459
PR-URL: https://github.com/nodejs/node/pull/10362
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
test-buffer-creation-regression is flaky on some SmartOS hosts in CI,
timing out. Move to sequential so it does not compete with other tests
for resources. Reduce three test cases to just the one needed to
identify the regression.
PR-URL: https://github.com/nodejs/node/pull/10161
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Requiring a file from a directory that contains an invalid package.json
file should throw an error.
PR-URL: https://github.com/nodejs/node/pull/10044
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
`test-regress-GH-897` is dependent on a timer firing within a period of
time. Especially on some of the FreeBSD hosts on CI, we have seen tests
like that fail when run in parallel. (This may have nothing to do with
FreeBSD and may just mean that the hosts are resource-constrained.) Move
this test to sequential as we have done with several other
timer-dependent tests recently.
The test has also been refactored and documented via comments.
PR-URL: https://github.com/nodejs/node/pull/9487
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Timer-dependent tests fail frequently on certain platforms in CI when
run in parallel with other tests, likely due to competition for
resources. Move test-repl-timeout-throw to sequential to avoid this
problem. Also did some minor refactoring (var->const and more use of
assert.strictEqual of looser assertions).
PR-URL: https://github.com/nodejs/node/pull/9431
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: Johan Bergstrom <bugs@bergstroem.nu>
checkExecSyncError() creates error objects for execSync() and
execFileSync(). If the child process created stderr output, then
it is attached to the end of the error message. However, stderr
can be an empty Buffer object, which always passes the truthy
check, leading to an extra newline in the error message. This
commit adds a length check, which will work with both strings and
Buffers.
PR-URL: https://github.com/nodejs/node/pull/9343
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Remove unneeded timers from some tests and move others from parallel
testing to sequential testing.
This is to resolve test failures on freebsd10-64 on CI. The failures
are all due to timers firing later than expected. Timers firing later
than they are set for can happen on resource-constrained hosts and is
not a bug.
In general, it may be wise to put tests that depend on timing into
sequential testing rather than parallel testing, as the timing can
be affected by other simultaneously-running test processes.
Fixes: https://github.com/nodejs/node/issues/8041
Fixes: https://github.com/nodejs/node/issues/9227
PR-URL: https://github.com/nodejs/node/pull/9317
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Julien Gilli <jgilli@nodejs.org>
Reviewed-By: Johan Bergstrom <bugs@bergstroem.nu>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
test-child-process-pass-fd.js parent can exit with an error on failure
to fork, in which case it will leak child processes. Limit child
lifetime to that of parent.
Fixes: https://github.com/nodejs/node/issues/9255
PR-URL: https://github.com/nodejs/node/pull/9257
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Replace calls to assert.equal() and assert.notEqual() with
assert.strictEqual() and assert.strictNotEqual() respectively.
PR-URL: https://github.com/nodejs/node/pull/9263
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit adds coverage for errors returned by execFileSync()
when the child process exits with a non-zero code.
PR-URL: https://github.com/nodejs/node/pull/9211
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Verify that a package.json without a .main property loads index.js.
PR-URL: https://github.com/nodejs/node/pull/9196
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Move sequential/test-crypto-timing-safe-equal-benchmarks to test/pummel
because it fails for me locally quite frequently and because it takes
about five or six seconds to complete, which is too long for a test in
test/sequential.
Fixes: https://github.com/nodejs/node/issues/8744
PR-URL: https://github.com/nodejs/node/pull/9241
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: not-an-aardvark <not-an-aardvark@users.noreply.github.com>
The no-useless-escape rule in ESLint did not previously flag certain
unnecessary escaping in template strings. These will be flagged in
ESLint 3.8.0.
PR-URL: https://github.com/nodejs/node/pull/9112
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Refactored test:
- 'var' to 'const'
- functon to arrow function
- using common.mustCall() and common.fail()
PR-URL: https://github.com/nodejs/node/pull/8586
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
The `crypto.timingSafeEqual` test still seems to be a bit flaky. This
makes a few changes to the test:
* Separates the basic usage and the benchmarking into different tests
* Moves the timing-sensitive benchmark function into a separate module,
and reparses the module on every iteration of the loop to avoid shared
state between timing measurements.
PR-URL: https://github.com/nodejs/node/pull/8456
Reviewed-By: James M Snell <jasnell@gmail.com>
Reinstate crypto.timingSafeEqual() which was reverted due to test
issues. The flaky test issues are resolved in this new changeset.
PR-URL: https://github.com/nodejs/node/pull/8304
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Commit 2272052 ("net: bind to `::` TCP address by default") from
April 2014 seems to have accidentally changed the default listen
address from 127.0.0.1 to 0.0.0.0, a.k.a. the "any" address.
From a security viewpoint it's undesirable to accept debug agent
connections from anywhere so let's change that back. Users can
override the default with the `--debug=<host>:<port>` switch.
Fixes: https://github.com/nodejs/node/issues/8081
PR-URL: https://github.com/nodejs/node/pull/8106
Reviewed-By: James M Snell <jasnell@gmail.com>
There's an issue on some `OS X` versions when passing fd's between processes.
When the handle associated to a specific file descriptor is closed by the sender
process before it's received in the destination, the handle is indeed closed
while it should remain opened. In order to fix this behaviour, don't close the
handle until the `NODE_HANDLE_ACK` is received by the sender.
Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but
creating lots of workers, so the issue reproduces on `OS X` consistently.
Fixes: https://github.com/nodejs/node/issues/7512
PR-URL: https://github.com/nodejs/node/pull/7572
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/8040
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
This reverts commit fce4b981ea.
This was a breaking change and should have been marked semver-major.
The change that was made altered the output of util.format() and
util.inspect(). With how much those are used in the wild, this type of
change deserves more justification.
Fixes: https://github.com/nodejs/node/issues/8138
PR-URL: https://github.com/nodejs/node/pull/8143
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
`test-fs-watch-recursive` and `test-fs-watch` were both watching the
same folder: `tmp/testsubdir` so running them sequentially on `OS X`
could make `test-fs-watch` to fail due to events generated in the other
test. Make them watch a random directory to fix the issue.
Fixes: https://github.com/nodejs/node/issues/8045
PR-URL: https://github.com/nodejs/node/pull/8115
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
`\n` is not enough for Linux with some custom stream
add carriage returns to ensure that the output is displayed correctly
using `\r\n` should not be a problem, even on non-Windows platforms.
Fixes: https://github.com/nodejs/node/issues/7954
PR-URL: https://github.com/nodejs/node/pull/8028
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Classes cannot be instantiated without new, but util.deprecate()
uses Function.prototype.apply(). This commit uses new.target to
detect constructor calls, allowing classes to be deprecated.
PR-URL: https://github.com/nodejs/node/pull/7690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Use the common.isWindows, common.isFreeBSD and common.isSunOS where
possible.
Add common.isOSX and common.isLinux.
Fix `test-fs-read-file-sync-hostname` as in its current form was not
being run anywhere.
PR-URL: https://github.com/nodejs/node/pull/7845
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
The `test/common` module has the capability to identify if any variable
is leaked to the global scope and fail the test. So that has to be
imported at the beginning.
PR-URL: https://github.com/nodejs/node/pull/7786
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
If something bad happens in spawnSync, stderr might be null. Therefore,
we have to check it before using it, so we won't mask the actual
exception.
PR-URL: https://github.com/nodejs/node/pull/6877
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>