A few of the child process tests can be simplified by computing
the OS specific root directory in common and then accessing that
value.
PR-URL: https://github.com/nodejs/node/pull/7685
Reviewed-By: Roman Reiss <me@silverwind.io>
This commit refactors test-child-process-spawnsync.js to use
the reusable common.spawnSyncPwd().
PR-URL: https://github.com/nodejs/node/pull/6939
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
When the 'buffer' encoding is passed to spawnSync(), an exception
is thrown in Buffer's toString() method because 'buffer' is not
a valid encoding there. This commit special cases the 'buffer'
encoding.
Fixes: https://github.com/nodejs/node/issues/6930
PR-URL: https://github.com/nodejs/node/pull/6939
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
In preparation for a lint rule that will enforce
assert.deepStrictEqual() over assert.deepEqual(), change tests and
benchmarks accordingly. For tests and benchmarks that are testing or
benchmarking assert.deepEqual() itself, apply a comment to ignore the
upcoming rule.
PR-URL: https://github.com/nodejs/node/pull/6213
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Now that we have backticks we no longer need to use util.format
to template strings!
This commit was inspired by #3324, and it replaces instances of
util.format with backtick strings in a number of tests
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3359
There's a bunch of stuff in test-child-process-spawnsync.js that seems
designed to test that it is in fact blocking/synchronous. However, that
code really just tests the OS sleep command. Change `sleep 1` to `sleep
0` and shave about one second off the test run.`
We check the return status to confirm the command is successful. The
tests in this file in general would not work if spawnSync() were
asynchronous. That includes this one, as a return status would not be
available if the command where asynchronous.
PR-URL: https://github.com/nodejs/node/pull/2542
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The test had checked that a timer fired within a period after
spawnSync() returns. The result was a test that sometimes was
flaky.
Because there's no guarantee of how long a timer will take
before running, remove the check. There is a check that the
timer runs after spawnSync() so that is sufficient.
PR-URL: https://github.com/nodejs/node/pull/2535
Fixes: https://github.com/nodejs/node/issues/2470
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
In the tests, we use "process.platform === 'win32'" in some places.
This patch replaces them with the "common.isWindows" for consistency.
PR-URL: https://github.com/nodejs/io.js/pull/2269
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.
test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.
PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit validates the properties of ENOENT error objects
returned by spawn() and spawnSync().
PR-URL: https://github.com/iojs/io.js/pull/838
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
The copyright and license notice is already in the LICENSE file. There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.