2023-11-08 19:32:12 +05:30
|
|
|
'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,/);
|
|
|
|
|
});
|
2024-07-13 11:10:59 -04:00
|
|
|
|
|
|
|
|
test('isolation=none uses the --test-timeout flag', async () => {
|
|
|
|
|
const args = [
|
2024-12-19 21:10:26 -05:00
|
|
|
'--test', '--test-isolation=none', '--test-timeout=10',
|
2024-07-13 11:10:59 -04:00
|
|
|
];
|
|
|
|
|
const cp = spawnSync(process.execPath, args, { cwd, env });
|
|
|
|
|
assert.match(cp.stderr.toString(), /timeout: 10,/);
|
|
|
|
|
});
|