mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
test_runner: fix timeout not propagated to the child process in run
PR-URL: https://github.com/nodejs/node/pull/58831 Fixes: https://github.com/nodejs/node/issues/58802 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Adrian Estrada <edsadr@gmail.com>
This commit is contained in:
parent
488febf856
commit
94f7568e5c
|
|
@ -145,6 +145,7 @@ function getRunArgs(path, { forceExit,
|
||||||
only,
|
only,
|
||||||
argv: suppliedArgs,
|
argv: suppliedArgs,
|
||||||
execArgv,
|
execArgv,
|
||||||
|
root: { timeout },
|
||||||
cwd }) {
|
cwd }) {
|
||||||
const argv = ArrayPrototypeFilter(process.execArgv, filterExecArgv);
|
const argv = ArrayPrototypeFilter(process.execArgv, filterExecArgv);
|
||||||
if (forceExit === true) {
|
if (forceExit === true) {
|
||||||
|
|
@ -162,6 +163,9 @@ function getRunArgs(path, { forceExit,
|
||||||
if (only === true) {
|
if (only === true) {
|
||||||
ArrayPrototypePush(argv, '--test-only');
|
ArrayPrototypePush(argv, '--test-only');
|
||||||
}
|
}
|
||||||
|
if (timeout != null) {
|
||||||
|
ArrayPrototypePush(argv, `--test-timeout=${timeout}`);
|
||||||
|
}
|
||||||
|
|
||||||
ArrayPrototypePushApply(argv, execArgv);
|
ArrayPrototypePushApply(argv, execArgv);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,11 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
|
||||||
|
|
||||||
it('should support timeout', async () => {
|
it('should support timeout', async () => {
|
||||||
const stream = run({ timeout: 50, files: [
|
const stream = run({ timeout: 50, files: [
|
||||||
fixtures.path('test-runner', 'timeout-basic.mjs'),
|
fixtures.path('test-runner', 'plan', 'timeout-basic.mjs'),
|
||||||
] });
|
] });
|
||||||
stream.on('test:fail', common.mustCall(1));
|
stream.on('test:fail', common.mustCall((data) => {
|
||||||
|
assert.strictEqual(data.details.error.failureType, 'testTimeoutFailure');
|
||||||
|
}, 2));
|
||||||
stream.on('test:pass', common.mustNotCall());
|
stream.on('test:pass', common.mustNotCall());
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
for await (const _ of stream);
|
for await (const _ of stream);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user