mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

This commit stabilizes test isolation configuration in the test runner. PR-URL: https://github.com/nodejs/node/pull/56298 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
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 concurrency', async () => {
|
|
const args = ['--test'];
|
|
const cp = spawnSync(process.execPath, args, { cwd, env });
|
|
assert.match(cp.stderr.toString(), /concurrency: true,/);
|
|
});
|
|
|
|
test('concurrency of one', async () => {
|
|
const args = ['--test', '--test-concurrency=1'];
|
|
const cp = spawnSync(process.execPath, args, { cwd, env });
|
|
assert.match(cp.stderr.toString(), /concurrency: 1,/);
|
|
});
|
|
|
|
test('concurrency of two', async () => {
|
|
const args = ['--test', '--test-concurrency=2'];
|
|
const cp = spawnSync(process.execPath, args, { cwd, env });
|
|
assert.match(cp.stderr.toString(), /concurrency: 2,/);
|
|
});
|
|
|
|
test('isolation=none uses a concurrency of one', async () => {
|
|
const args = ['--test', '--test-isolation=none'];
|
|
const cp = spawnSync(process.execPath, args, { cwd, env });
|
|
assert.match(cp.stderr.toString(), /concurrency: 1,/);
|
|
});
|
|
|
|
test('isolation=none overrides --test-concurrency', async () => {
|
|
const args = [
|
|
'--test', '--test-isolation=none', '--test-concurrency=2',
|
|
];
|
|
const cp = spawnSync(process.execPath, args, { cwd, env });
|
|
assert.match(cp.stderr.toString(), /concurrency: 1,/);
|
|
});
|