node/test/parallel/test-runner-cli-timeout.js
Shubham Pandey 43dcaa3428
test_runner, cli: add --test-timeout flag
PR-URL: https://github.com/nodejs/node/pull/50443
Fixes: https://github.com/nodejs/node/issues/50431
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-11-08 14:02:12 +00:00

20 lines
750 B
JavaScript

'use strict';
require('../common');
const fixtures = require('../common/fixtures');
const assert = require('node:assert');
const { spawnSync } = require('node:child_process');
const { test } = require('node:test');
const cwd = fixtures.path('test-runner', 'default-behavior');
const env = { ...process.env, 'NODE_DEBUG': 'test_runner' };
test('default timeout -- Infinity', async () => {
const args = ['--test'];
const cp = spawnSync(process.execPath, args, { cwd, env });
assert.match(cp.stderr.toString(), /timeout: Infinity,/);
});
test('timeout of 10ms', async () => {
const args = ['--test', '--test-timeout', 10];
const cp = spawnSync(process.execPath, args, { cwd, env });
assert.match(cp.stderr.toString(), /timeout: 10,/);
});