* 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 unnecessary variables
PR-URL: https://github.com/nodejs/node/pull/10440
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Swap var for let/const throughout the common.js module.
Change a snake case variable to camel case starting on line 168.
PR-URL: https://github.com/nodejs/node/pull/10177
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/10245
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
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>
* use const instead of var
* use common.mustCall to control the functions execution automatically
* use assert.strictEqual instead of assert.equal
* use assert.notStrictEqual instead of assert.notEqual
* use arrow functions
PR-URL: https://github.com/nodejs/node/pull/10367
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
* use const instead of var
* use assert.strictEqual instead assert.equal
PR-URL https://github.com/nodejs/node/pull/10428
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* use const instead of var
* use assert.strictEqual instead of assert.equal
PR-URL: https://github.com/nodejs/node/pull/10429
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Allow `fs.read`, `fs.write` and `fs.writeFile` to take
`Uint8Array` arguments.
PR-URL: https://github.com/nodejs/node/pull/10382
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
This test expects the string 'Debugger listening on port' on stderr and
since the message has been changed to 'Debugger listening on host:port'
this was failing always.
Apart from that, this test expects the main script's name to be
`src/node.js`, but that has been renamed to `lib/internal/node.js` and
then to `lib/internal/bootstrap_node.js`. So, the script name has been
updated.
Apart from that, using `const` instead of `var` wherever possible.
Refer: https://github.com/nodejs/node/issues/10361
PR-URL: https://github.com/nodejs/node/pull/10371
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Currently, around line 417 lib/url.js is truncating hostname and put the
rest of hostname to the path if hostname length after `.` is equal or
more than 63. This behavior is different from browser behavior. I
changed the code so that it doesn’t truncate.
I also added the test example which has more than 63 length in after
`.` in hostname in test url.
PR-URL: https://github.com/nodejs/node/pull/9292
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Adds test for transcoding an empty buffer.
PR-URL: https://github.com/nodejs/node/pull/10437
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Change var to const or let.
Change assert.equal() to assert.strictEqual().
PR-URL: https://github.com/nodejs/node/pull/9990
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
This test runs based on a expectation that the stderr will get the
string 'Debugger listening on port'. But the actual message printed
to stderr has changed to 'Debugger listening on host:port'. So the
the actuals tests did not even start and eventually timeout.
Apart from that, changed `var`s to `let`s or `const`s.
Refs: https://github.com/nodejs/node/issues/10361
PR-URL: https://github.com/nodejs/node/pull/10370
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com
* var -> const
* add RegExp to assert.throws() to check error message
PR-URL: https://github.com/nodejs/node/pull/10016
Reviewed-By: James M Snell <jasnell@gmail.com>
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.
PR-URL: https://github.com/nodejs/node/pull/9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Changing var defs to const/let, changing assert.equal to
assert.strictEqual. Wrapping functions called once with
common.mustCall
PR-URL: https://github.com/nodejs/node/pull/10054
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
var -> let / const
added common.mustCall() to callback
assert.equal() -> assert.strictEqual()
PR-URL: https://github.com/nodejs/node/pull/10017
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
change var to const and add mustCall
PR-URL: https://github.com/nodejs/node/pull/9954
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
- `var` --> `const` as applicable
- `assert.equal` --> `assert.strictEqual`
- `assert(false, ..)` --> `common.fail()`
- `common.mustCall` for functions that need to be called exactly once
- modified an `assert(!signal, 'Worker exited by a signal');` call to
`assert.strictEqual(signal, null);` call as that made more sense
PR-URL: https://github.com/nodejs/node/pull/10049
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Changed var to const, assert.equal to assert.strictEqual, and
used a template string for error output.
PR-URL: https://github.com/nodejs/node/pull/9986
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Remove `setTimeout()` in test and instead rely on `common.mustCall()` on
a `timeout` event handler.
The test was flaky on CI. The flakiness was replicable by running the
test under load. This version, in contrast, is robust under load.
Took the opportunity to do some `var` -> `const` while refactoring.
PR-URL: https://github.com/nodejs/node/pull/10404
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
convert var to const
PR-URL: https://github.com/nodejs/node/pull/9953
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Use assert.strictEqual instead of assert.equal and assert.ok
PR-URL: https://github.com/nodejs/node/pull/10420
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Add a RegExp as a second argument to assert.throws().
PR-URL: https://github.com/nodejs/node/pull/10058
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/10390
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julian Duque <julianduquej@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
* use let and const instead of var
* use assert.strictEqual instead assert.equal
PR-URL: https://github.com/nodejs/node/pull/10396
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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>
* use common.mustCall to control the functions execution automatically
* use const instead of var
* use assert.strictEqual instead assert.equal
* use assert.ifError instead of throw error
PR-URL: https://github.com/nodejs/node/pull/10297
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
* use const instead of var for required modules
* use assert.strictEqual instead of assert.equal
PR-URL: https://github.com/nodejs/node/pull/10318
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Previously, autocompletion of scoped packages was not supported by the
repl due to not including the `@` character in the regular expression.
PR-URL: https://github.com/nodejs/node/pull/10296
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This is to be consistent with the other operators and helps
understanding the context when the code is grepped.
PR-URL: https://github.com/nodejs/node/pull/10213
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
In this test, I changed the var declarations to be either a let or a
const. For some of the callbacks, I added a mustCall check to ensure
that the functions have run. I also changed assert.equal() to
assert.strictEqual().
PR-URL: https://github.com/nodejs/node/pull/9962
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
In this change, I've added the regex pattern to the assert.throws()
in order to provide the validation argument for the call.
PR-URL: https://github.com/nodejs/node/pull/9918
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
- Updated assert.equal to assert.strictEqual
- Updated 'var' to 'const'
- Using template literals
PR-URL: https://github.com/nodejs/node/pull/10036
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
- var -> const where possible
- assert.equal -> assert.strictEqual
- passed the setTimeout function a second parameter for readability
- used assert.strictEqual for assert(!c) as it is expected to be 0 and
not some other value
PR-URL: https://github.com/nodejs/node/pull/10321
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.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>
After processing all the callbacks in the destroy_ids vector make sure
to clear() it otherwise the DestroyIdsCb() won't run again.
PR-URL: https://github.com/nodejs/node/pull/10400
Fixes: b49b496 "async_wrap: call destroy() callback in uv_idle_t"
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
The original test lauches 10 child processes at once
and bypass `test.py`'s process regulation.
This PR reduces the unmanaged parallelism and is a
temporary workaround for #9979 (not a real fix).
PR-URL: https://github.com/nodejs/node/pull/10329
Reviewed-By: Anna Henningsen <anna@addaleax.net>
* var -> const, let
* assert.equal() -> assert.strictEqual()
PR-URL: https://github.com/nodejs/node/pull/9948
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
10.5 error Please use assert.strictEqual() instead of assert.equal()
PR-URL: https://github.com/nodejs/node/pull/10047
Reviewed-By: James M Snell <jasnell@gmail.com>