2023-10-01 15:46:14 +00:00
|
|
|
'use strict';
|
2023-10-12 01:37:00 +00:00
|
|
|
require('../common');
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const assert = require('node:assert');
|
2023-10-01 15:46:14 +00:00
|
|
|
const { spawnSync } = require('node:child_process');
|
2023-10-12 01:37:00 +00:00
|
|
|
const { test } = require('node:test');
|
|
|
|
const cwd = fixtures.path('test-runner', 'default-behavior');
|
|
|
|
const env = { ...process.env, 'NODE_DEBUG': 'test_runner' };
|
2023-10-01 15:46:14 +00:00
|
|
|
|
2023-10-12 01:37:00 +00:00
|
|
|
test('default concurrency', async () => {
|
|
|
|
const args = ['--test'];
|
|
|
|
const cp = spawnSync(process.execPath, args, { cwd, env });
|
|
|
|
assert.match(cp.stderr.toString(), /concurrency: true,/);
|
2023-10-01 15:46:14 +00:00
|
|
|
});
|
|
|
|
|
2023-10-12 01:37:00 +00:00
|
|
|
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,/);
|
2023-10-01 15:46:14 +00:00
|
|
|
});
|
|
|
|
|
2023-10-12 01:37:00 +00:00
|
|
|
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,/);
|
2023-10-01 15:46:14 +00:00
|
|
|
});
|
2024-07-13 15:10:59 +00:00
|
|
|
|
|
|
|
test('isolation=none uses a concurrency of one', async () => {
|
|
|
|
const args = ['--test', '--experimental-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', '--experimental-test-isolation=none', '--test-concurrency=2',
|
|
|
|
];
|
|
|
|
const cp = spawnSync(process.execPath, args, { cwd, env });
|
|
|
|
assert.match(cp.stderr.toString(), /concurrency: 1,/);
|
|
|
|
});
|