Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

test: add focused execution and configurable concurrency

tt-a1i24957f0c8c1e
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 577cf03f..27184746 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -62,9 +62,33 @@ The renderer package is in `archify/`; repository tests and their dependencies l
```sh
npm ci
npm --prefix archify ci
-npm test
+npm run test:focus -- test/geometry.test.mjs
```
+For the development loop, select the files covering the changed behavior with
+`npm run test:focus -- test/<name>.test.mjs [test/<other>.test.mjs ...]`.
+This runs only those suites, without the generated-output checks or golden pass.
+It requires at least one file and rejects unknown files rather than silently
+running the full suite. Paths are relative to the repository root; absolute
+paths also work. Use `--list` with the same selection to inspect it without
+running tests. A focused pass is evidence for that selection only.
+
+To narrow a large file further, add a quoted Node test-name pattern (Node 18.11+):
+
+```sh
+npm run test:focus -- test/cli.test.mjs '--test-name-pattern=cli: validate'
+```
+
+Nested tests follow Node's filtering rules: include their parent test names in
+the pattern as well. Check the reported pass/skip counts for the intended cases.
+
+`npm test` still runs all generated-output checks, golden comparisons, and every
+discovered test suite. Both test runners accept `--concurrency=N` to tune the
+number of simultaneous test files on Node 18.19+, for example
+`npm test -- --concurrency=4`. The default remains 2.
+Compare timing and results on the same machine before increasing concurrency;
+browser tests can become slower or unstable under CPU contention.
+
Test through public behavior such as `render`, `validate`, `deliver`, `visual-check`, or final SVG/HTML. Behavioral fixes should include a regression that demonstrates the original failure. Private helper checks can supplement that evidence.
For geometry and layout changes, use the smallest redacted JSON reproduction, relevant checked-in examples, and frozen compatibility fixtures. Compare base and candidate with the same input and browser conditions. Identify intended changes and investigate unexpected ones; updating golden files alone does not establish visual or compatibility acceptance.
@@ -74,7 +98,7 @@ A visual PR must provide enough evidence to evaluate whether the intended user v
Static SVG/XML checks cannot establish browser layout, font settling, or interaction behavior. When the adaptive reader or Viewer layout changes, run the real browser test with Chrome available:
```sh
-ARCHIFY_CHROME="/path/to/chrome" node --test test/desktop-reader-browser.test.mjs
+ARCHIFY_CHROME="/path/to/chrome" npm run test:browser -- test/desktop-reader-browser.test.mjs
```
A browser test skipped because Chrome was unavailable is **skipped**, not passed. Follow [the delivery contract](archify/references/delivery-contract.md) for visual evidence, receipts, and failure stages. Successful validation, atomic delivery, browser checks, and perceptual review establish different claims.
@@ -91,6 +115,12 @@ suites there so both workflows keep the same coverage. Ordinary `npm test`
retains optional browser skips. Real WebM decoding and site-language integration
remain in the separate `npm run test:webm` gate used by both workflows.
+Only set `ARCHIFY_CHROME` for the browser run when you also plan to run the full
+browser gate: many browser suites are included in `npm test` and would otherwise
+execute again. The ordinary CI Node matrix and required browser gate retain
+their existing coverage. Reuse the applicable final-head CI results instead of
+repeating an unchanged full suite locally.
+
## Packages and generated artifacts
Viewer maintenance starts in [`viewer/`](viewer/README.md). Edit its source
diff --git a/package.json b/package.json
index 78c6694a..ad2417e3 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
},
"scripts": {
"test": "npm --prefix archify run check:viewer && npm --prefix archify run check:brand-marks && npm --prefix archify run check:validators && npm --prefix archify run check:release-identity && node test/golden.mjs && node scripts/run-tests.mjs",
+ "test:focus": "node scripts/run-tests.mjs --require-files",
"test:browser": "node scripts/run-browser-tests.mjs",
"test:webm": "node test/webm-artifact.smoke.mjs && node --test test/site-language-integration.mjs"
},
diff --git a/scripts/run-browser-tests.mjs b/scripts/run-browser-tests.mjs
index e1736db5..4bf4fc45 100644
--- a/scripts/run-browser-tests.mjs
+++ b/scripts/run-browser-tests.mjs
@@ -4,6 +4,7 @@ import { spawnSync } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { findChrome } from '../archify/bin/visual-check.mjs';
+import { testRunnerOptions } from './test-runner-options.mjs';
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
// Shared by PR CI and tag releases. WebM decoding stays in test:webm.
@@ -41,17 +42,28 @@ const testFiles = [
'class-motion-browser.test.mjs',
];
+let options;
+try {
+ options = testRunnerOptions(process.argv.slice(2), {
+ repoRoot, testFiles: testFiles.map(file => path.join('test', file)),
+ });
+} catch (error) {
+ console.error(error.message);
+ process.exit(1);
+}
+if (options.list) {
+ console.log(options.files.join('\n'));
+ process.exit(0);
+}
+
const chrome = findChrome();
if (!chrome) {
console.error('Browser tests require an executable Chrome/Chromium. Set ARCHIFY_CHROME to its path; this gate cannot skip browser coverage.');
process.exit(1);
}
-const args = ['--test'];
-const [major, minor] = process.versions.node.split('.').map(Number);
-if (major > 18 || (major === 18 && minor >= 19)) args.push('--test-concurrency=2');
-args.push(...testFiles.map((file) => path.join('test', file)));
-const result = spawnSync(process.execPath, args, {
+console.error(`Browser tests: ${options.files.length} files, concurrency ${options.concurrency}`);
+const result = spawnSync(process.execPath, options.args, {
cwd: repoRoot,
env: { ...process.env, ARCHIFY_CHROME: chrome },
stdio: 'inherit',
diff --git a/scripts/run-tests.mjs b/scripts/run-tests.mjs
index 1954c0d8..a93049b1 100644
--- a/scripts/run-tests.mjs
+++ b/scripts/run-tests.mjs
@@ -5,6 +5,7 @@ import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
+import { testRunnerOptions } from './test-runner-options.mjs';
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const testRoot = path.join(repoRoot, 'test');
@@ -13,20 +14,31 @@ const testFiles = fs.readdirSync(testRoot)
.sort()
.map((entry) => path.join('test', entry));
-const [major, minor] = process.versions.node.split('.').map(Number);
-const supportsConcurrencyFlag = major > 18 || (major === 18 && minor >= 19);
-const args = ['--test'];
-if (supportsConcurrencyFlag) args.push('--test-concurrency=2');
-args.push(...testFiles);
+let options;
+try {
+ options = testRunnerOptions(process.argv.slice(2), { repoRoot, testFiles, allowRequireFiles: true });
+} catch (error) {
+ console.error(error.message);
+ process.exit(1);
+}
+if (options.list) {
+ console.log(options.files.join('\n'));
+ process.exit(0);
+}
+console.error(`Repository tests: ${options.files.length} files, concurrency ${options.concurrency}`);
// Delivery commands check for updates; keep that state out of the user's cache.
const updateCache = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'archify-test-update-')));
-const result = spawnSync(process.execPath, args, {
- cwd: repoRoot,
- stdio: 'inherit',
- env: { ...process.env, ARCHIFY_UPDATE_CACHE_DIRECTORY: updateCache },
-});
-fs.rmSync(updateCache, { recursive: true, force: true });
+let result;
+try {
+ result = spawnSync(process.execPath, options.args, {
+ cwd: repoRoot,
+ stdio: 'inherit',
+ env: { ...process.env, ARCHIFY_UPDATE_CACHE_DIRECTORY: updateCache },
+ });
+} finally {
+ fs.rmSync(updateCache, { recursive: true, force: true });
+}
if (result.error) throw result.error;
if (result.signal) {
diff --git a/scripts/test-runner-options.mjs b/scripts/test-runner-options.mjs
new file mode 100644
index 00000000..d37607b5
--- /dev/null
+++ b/scripts/test-runner-options.mjs
@@ -0,0 +1,59 @@
+import path from 'node:path';
+
+// Both runners accept exact files, never infer coverage from changed sources.
+export function testRunnerOptions(argv, { repoRoot, testFiles, allowRequireFiles = false }) {
+ let concurrency = 2;
+ let explicitConcurrency = false;
+ let list = false;
+ let requireFiles = false;
+ let namePattern;
+ const selected = [];
+ const knownFiles = new Map(testFiles.map(file => [path.resolve(repoRoot, file), file]));
+ for (const argument of argv) {
+ if (argument === '--list') {
+ list = true;
+ } else if (argument === '--require-files' && allowRequireFiles) {
+ requireFiles = true;
+ } else if (argument.startsWith('--concurrency=')) {
+ const value = argument.slice('--concurrency='.length);
+ if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value))) {
+ throw new Error('--concurrency must be a positive safe integer');
+ }
+ concurrency = Number(value);
+ explicitConcurrency = true;
+ } else if (argument.startsWith('--test-name-pattern=')) {
+ const value = argument.slice('--test-name-pattern='.length);
+ if (!value) throw new Error('--test-name-pattern=<regex> requires a non-empty regular expression');
+ try {
+ new RegExp(value);
+ } catch {
+ throw new Error('--test-name-pattern=<regex> requires a valid regular expression');
+ }
+ namePattern = value;
+ } else if (argument.startsWith('-')) {
+ throw new Error(`Unknown test runner option: ${argument}. Use --list, --concurrency=N or --test-name-pattern=<regex>`);
+ } else {
+ const file = knownFiles.get(path.resolve(repoRoot, argument));
+ if (!file) throw new Error(`File is not in this runner's test inventory: ${argument}`);
+ if (!selected.includes(file)) selected.push(file);
+ }
+ }
+ if (requireFiles && selected.length === 0) {
+ throw new Error('Focused tests require at least one explicit test file');
+ }
+ const [major, minor] = process.versions.node.split('.').map(Number);
+ const supportsConcurrency = major > 18 || (major === 18 && minor >= 19);
+ const supportsNamePattern = major > 18 || (major === 18 && minor >= 11);
+ if (explicitConcurrency && !supportsConcurrency) {
+ throw new Error('--concurrency requires Node 18.19 or newer');
+ }
+ if (namePattern !== undefined && !supportsNamePattern) {
+ throw new Error('--test-name-pattern requires Node 18.11 or newer');
+ }
+ const files = selected.length ? selected : testFiles;
+ const args = ['--test'];
+ if (supportsConcurrency) args.push(`--test-concurrency=${concurrency}`);
+ if (namePattern !== undefined) args.push(`--test-name-pattern=${namePattern}`);
+ args.push(...files);
+ return { files, args, list, concurrency: supportsConcurrency ? concurrency : 'Node default' };
+}
diff --git a/test/browser-gate.test.mjs b/test/browser-gate.test.mjs
index 57ba43e0..2d6040bb 100644
--- a/test/browser-gate.test.mjs
+++ b/test/browser-gate.test.mjs
@@ -9,6 +9,9 @@ import { fileURLToPath } from 'node:url';
const skillRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'archify');
const repoRoot = path.dirname(skillRoot);
const runner = path.join(repoRoot, 'scripts/run-browser-tests.mjs');
+const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(Number);
+const supportsConcurrency = nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 19);
+const supportsNamePattern = nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 11);
test('browser gate rejects an unavailable explicit browser instead of skipping', (t) => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-browser-gate-'));
@@ -25,7 +28,7 @@ test('browser gate rejects an unavailable explicit browser instead of skipping',
// Observe the public runner's child invocation without starting real browsers
// in the ordinary Node matrix. The explicit browser gate supplies real coverage.
-function interceptedRun(t, outcome) {
+function interceptedRun(t, outcome, args = []) {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-browser-gate-'));
t.after(() => fs.rmSync(directory, { recursive: true, force: true }));
const preload = path.join(directory, 'capture-runner.cjs');
@@ -37,7 +40,7 @@ childProcess.spawnSync = (command, args, options) => {
};
require('node:module').syncBuiltinESMExports();
`);
- return spawnSync(process.execPath, ['--require', preload, runner], {
+ return spawnSync(process.execPath, ['--require', preload, runner, ...args], {
cwd: directory,
encoding: 'utf8',
env: { ...process.env, ARCHIFY_CHROME: process.execPath },
@@ -52,6 +55,10 @@ test('browser gate includes dedicated and mixed browser suites and enables them'
assert.equal(fs.realpathSync(call.cwd), fs.realpathSync(repoRoot));
assert.equal(call.chrome, process.execPath);
assert.ok(call.args.includes('--test'));
+ const [major, minor] = process.versions.node.split('.').map(Number);
+ if (major > 18 || (major === 18 && minor >= 19)) {
+ assert.ok(call.args.includes('--test-concurrency=2'));
+ }
const files = call.args.filter((arg) => !arg.startsWith('--'));
assert.equal(new Set(files).size, files.length);
for (const file of files) assert.ok(fs.existsSync(path.join(repoRoot, file)), file);
@@ -62,6 +69,58 @@ test('browser gate includes dedicated and mixed browser suites and enables them'
for (const file of required) assert.ok(files.includes(path.join('test', file)), `${file} must run in the browser gate`);
});
+test('browser gate focuses maintained mixed suites and supports explicit concurrency', (t) => {
+ const files = ['test/i18n.test.mjs', 'test/desktop-reader-browser.test.mjs'];
+ const result = interceptedRun(t, { status: 0 }, [files[0], path.join(repoRoot, files[1]),
+ ...(supportsConcurrency ? ['--concurrency=1'] : [])]);
+ assert.equal(result.status, 0, result.stderr);
+ const call = JSON.parse(result.stdout);
+ assert.deepEqual(call.args, ['--test', ...(supportsConcurrency ? ['--test-concurrency=1'] : []), ...files]);
+ assert.match(result.stderr, supportsConcurrency ? /2 files, concurrency 1/ : /2 files, concurrency Node default/);
+});
+
+test('browser gate forwards a validated test name pattern', (t) => {
+ const result = interceptedRun(t, { status: 0 }, ['test/i18n.test.mjs', '--test-name-pattern=locale.*日本語']);
+ if (!supportsNamePattern) {
+ assert.equal(result.status, 1);
+ assert.equal(result.stdout, '');
+ assert.match(result.stderr, /requires Node 18\.11 or newer/);
+ return;
+ }
+ assert.equal(result.status, 0, result.stderr);
+ assert.deepEqual(JSON.parse(result.stdout).args, [
+ '--test', ...(supportsConcurrency ? ['--test-concurrency=2'] : []),
+ '--test-name-pattern=locale.*日本語', 'test/i18n.test.mjs',
+ ]);
+});
+
+test('browser gate rejects files outside its inventory and invalid options before launch', (t) => {
+ for (const args of [['test/geometry.test.mjs'], ['--concurrency=0'], ['--unknown'],
+ ['--test-name-pattern='], ['--test-name-pattern=[']]) {
+ const result = interceptedRun(t, { status: 0 }, args);
+ assert.equal(result.status, 1, result.stderr);
+ assert.equal(result.stdout, '');
+ }
+});
+
+test('browser inventory can be listed without Chrome or child execution', (t) => {
+ const result = spawnSync(process.execPath, [runner, '--list'], {
+ encoding: 'utf8', env: { ...process.env, ARCHIFY_CHROME: '' },
+ });
+ assert.equal(result.status, 0, result.stderr);
+ const invocation = JSON.parse(interceptedRun(t, { status: 0 }).stdout);
+ assert.deepEqual(result.stdout.trim().split('\n'), invocation.args.filter(arg => !arg.startsWith('--')));
+ assert.equal(result.stderr, '');
+});
+
+test('selected browser execution still requires Chrome', () => {
+ const result = spawnSync(process.execPath, [runner, 'test/i18n.test.mjs'], {
+ encoding: 'utf8', env: { ...process.env, ARCHIFY_CHROME: '' },
+ });
+ assert.equal(result.status, 1, result.stderr);
+ assert.match(result.stderr, /require an executable Chrome\/Chromium/);
+});
+
for (const outcome of [{ status: 7, signal: null }, { status: null, signal: 'SIGTERM' }]) {
test(`browser gate propagates child failure (${outcome.signal || outcome.status})`, (t) => {
const result = interceptedRun(t, outcome);
diff --git a/test/repository-test-runner.test.mjs b/test/repository-test-runner.test.mjs
index c0de130c..f6214408 100644
--- a/test/repository-test-runner.test.mjs
+++ b/test/repository-test-runner.test.mjs
@@ -7,6 +7,126 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
const repoRoot = fileURLToPath(new URL('../', import.meta.url));
+const runner = path.join(repoRoot, 'scripts/run-tests.mjs');
+const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(Number);
+const supportsConcurrency = nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 19);
+const supportsNamePattern = nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 11);
+
+function interceptedRun(t, args = [], outcome = { status: 0 }, nodeVersion = process.versions.node) {
+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-runner-'));
+ t.after(() => fs.rmSync(directory, { recursive: true, force: true }));
+ const preload = path.join(directory, 'capture.cjs');
+ fs.writeFileSync(preload, `
+const childProcess = require('node:child_process');
+const fs = require('node:fs');
+Object.defineProperty(process.versions, 'node', { value: ${JSON.stringify(nodeVersion)} });
+childProcess.spawnSync = (command, args, options) => {
+ const cache = options.env.ARCHIFY_UPDATE_CACHE_DIRECTORY;
+ console.log(JSON.stringify({ command, args, cwd: options.cwd, cache, cacheExists: fs.existsSync(cache) }));
+ return ${JSON.stringify(outcome)};
+};
+require('node:module').syncBuiltinESMExports();
+`);
+ return spawnSync(process.execPath, ['--require', preload, runner, ...args], {
+ cwd: directory, encoding: 'utf8',
+ env: { ...process.env, ARCHIFY_UPDATE_CACHE_DIRECTORY: path.join(directory, 'user-cache') },
+ });
+}
+
+test('focused runner selects exact files from an unrelated cwd and cleans isolated cache', (t) => {
+ const files = ['test/repository-test-runner.test.mjs', 'test/browser-gate.test.mjs'];
+ const result = interceptedRun(t, ['--require-files', files[0], path.join(repoRoot, files[1]), files[0],
+ ...(supportsConcurrency ? ['--concurrency=3'] : [])]);
+ assert.equal(result.status, 0, result.stderr);
+ const call = JSON.parse(result.stdout);
+ assert.deepEqual(call.args, ['--test', ...(supportsConcurrency ? ['--test-concurrency=3'] : []), ...files]);
+ assert.equal(fs.realpathSync(call.cwd), fs.realpathSync(repoRoot));
+ assert.equal(call.cacheExists, true);
+ assert.match(path.basename(call.cache), /^archify-test-update-/);
+ assert.equal(fs.existsSync(call.cache), false);
+ assert.match(result.stderr, supportsConcurrency ? /2 files, concurrency 3/ : /2 files, concurrency Node default/);
+});
+
+test('supported older Node retains default operation and rejects explicit concurrency', (t) => {
+ const args = ['test/repository-test-runner.test.mjs'];
+ const result = interceptedRun(t, args, { status: 0 }, '18.18.0');
+ assert.equal(result.status, 0, result.stderr);
+ assert.deepEqual(JSON.parse(result.stdout).args, ['--test', ...args]);
+ const override = interceptedRun(t, ['--concurrency=2', ...args], { status: 0 }, '18.18.0');
+ assert.equal(override.status, 1);
+ assert.equal(override.stdout, '');
+ assert.match(override.stderr, /requires Node 18\.19 or newer/);
+});
+
+test('focused runner forwards a validated test name pattern as one child argument', (t) => {
+ const pattern = '^repository runner .*failure';
+ const result = interceptedRun(t, ['test/repository-test-runner.test.mjs', `--test-name-pattern=${pattern}`]);
+ if (!supportsNamePattern) {
+ assert.equal(result.status, 1);
+ assert.equal(result.stdout, '');
+ assert.match(result.stderr, /requires Node 18\.11 or newer/);
+ return;
+ }
+ assert.equal(result.status, 0, result.stderr);
+ assert.deepEqual(JSON.parse(result.stdout).args, [
+ '--test', ...(supportsConcurrency ? ['--test-concurrency=2'] : []),
+ `--test-name-pattern=${pattern}`, 'test/repository-test-runner.test.mjs',
+ ]);
+});
+
+test('test name selection fails clearly before Node 18.11 and works from that version', (t) => {
+ const args = ['test/repository-test-runner.test.mjs', '--test-name-pattern=selected'];
+ const unsupported = interceptedRun(t, args, { status: 0 }, '18.10.0');
+ assert.equal(unsupported.status, 1);
+ assert.equal(unsupported.stdout, '');
+ assert.match(unsupported.stderr, /requires Node 18\.11 or newer/);
+ const supported = interceptedRun(t, args, { status: 0 }, '18.11.0');
+ assert.equal(supported.status, 0, supported.stderr);
+ assert.deepEqual(JSON.parse(supported.stdout).args, [
+ '--test', '--test-name-pattern=selected', 'test/repository-test-runner.test.mjs',
+ ]);
+});
+
+test('runner lists inventory without launching or allocating a cache', (t) => {
+ const result = interceptedRun(t, ['--list']);
+ assert.equal(result.status, 0, result.stderr);
+ const files = fs.readdirSync(path.join(repoRoot, 'test'))
+ .filter(file => file.endsWith('.test.mjs')).sort().map(file => path.join('test', file));
+ assert.deepEqual(result.stdout.trim().split('\n'), files);
+ assert.equal(result.stderr, '');
+ const selected = interceptedRun(t, ['--list', 'test/browser-gate.test.mjs']);
+ assert.equal(selected.status, 0, selected.stderr);
+ assert.equal(selected.stdout.trim(), 'test/browser-gate.test.mjs');
+});
+
+test('focus alias requires files and invalid options never launch a child', (t) => {
+ const manifest = JSON.parse(fs.readFileSync(path.join(repoRoot, 'package.json'), 'utf8'));
+ assert.equal(manifest.scripts['test:focus'], 'node scripts/run-tests.mjs --require-files');
+ for (const args of [
+ ['--require-files'], ['--require-files', '--list'], ['test/missing.test.mjs'],
+ ['test'], ['package.json'], ['--unknown'], ['--concurrency=0'],
+ ['--concurrency=-1'], ['--concurrency=1.5'], ['--concurrency=abc'],
+ ['--concurrency=9007199254740992'],
+ ['--test-name-pattern='], ['--test-name-pattern=['], ['--test-name-pattern'],
+ ]) {
+ const result = interceptedRun(t, args);
+ assert.equal(result.status, 1, `${args}: ${result.stderr}`);
+ assert.equal(result.stdout, '', `${args} must not launch tests`);
+ assert.ok(result.stderr.trim());
+ }
+});
+
+for (const outcome of [{ status: 7 }, { status: null, signal: 'SIGTERM' }, { error: { message: 'spawn failed' } }]) {
+ test(`repository runner cleans cache and propagates child failure (${outcome.signal || outcome.status || 'error'})`, (t) => {
+ const result = interceptedRun(t, ['test/repository-test-runner.test.mjs'], outcome);
+ assert.equal(result.status, outcome.status ?? 1);
+ const call = JSON.parse(result.stdout);
+ assert.equal(call.cacheExists, true);
+ assert.equal(fs.existsSync(call.cache), false);
+ if (outcome.signal) assert.match(result.stderr, /terminated by SIGTERM/);
+ if (outcome.error) assert.match(result.stderr, /spawn failed/);
+ });
+}
test('repository runner discovers every test suite from an unrelated working directory', (t) => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-discovery-'));
@@ -25,6 +145,10 @@ require('node:module').syncBuiltinESMExports();
});
assert.equal(result.status, 0, result.stderr);
const invocation = JSON.parse(result.stdout);
+ const [major, minor] = process.versions.node.split('.').map(Number);
+ if (major > 18 || (major === 18 && minor >= 19)) {
+ assert.ok(invocation.args.includes('--test-concurrency=2'));
+ }
assert.equal(fs.realpathSync(invocation.cwd), fs.realpathSync(repoRoot));
const expected = fs.readdirSync(path.join(repoRoot, 'test'))
.filter(file => file.endsWith('.test.mjs')).sort().map(file => path.join('test', file));