Commit Graph

5 Commits

Author SHA1 Message Date
Joyee Cheung
64a5c01b99
test: add spawnSyncAndExit() and spawnSyncAndExitWithoutError()
Replaces expectSyncExit() and expectSyncExitWithoutError(). Since
we usually just check the child process right after its spawned,
these shorthands also takes care of the spawning. This makes the
tests more concise.

PR-URL: https://github.com/nodejs/node/pull/49200
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-08-18 16:54:19 +00:00
Joyee Cheung
034c80126e test: add expectSyncExitWithoutError() and expectSyncExit() utils
These can be used to check the state and the output of a child
process launched with `spawnSync()`. They log additional information
about the child process when the check fails to facilitate debugging
test failures.

PR-URL: https://github.com/nodejs/node/pull/49020
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-08-16 13:55:02 +02:00
Antoine du Hamel
73da2c426d
test: add trailing commas in test/common (#45550)
PR-URL: https://github.com/nodejs/node/pull/45550
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2022-11-21 18:38:12 +01:00
Joyee Cheung
f691bf5af5
test: ignore stale process cleanup failures on Windows
In some tests we try to clean up stale child processes on Windows,
but they don't necessarily exist, in that case we should ignore
any failures from the WMIC.exe command.

PR-URL: https://github.com/nodejs/node/pull/44480
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-09-13 08:55:30 +00:00
Joyee Cheung
fc9d44c8ac
test: deflake child process exec timeout tests
On Windows it might take too long for the parent to start the
communication with a child process, so by the time the parent
starts its own timer, the child process might have already
completed running, and the parent in those tests won't have a
chance to terminate these child processes after the timeout.
To address this issue, raise the time for which the child is
supposed to run to make sure that the parent starts
its own timer before the child terminates in the tests.
Also, split the test into smaller ones to reduce the overhead.

PR-URL: https://github.com/nodejs/node/pull/44390
Refs: https://github.com/nodejs/reliability/issues/356
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2022-09-01 02:31:34 +08:00