Cap npm test's parallel test files at one per spare core instead of a flat 8, so 3 and 4 core CI runners stop timing out page tests at random

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-26 21:22:26 -07:00
1 parent 5043b424cf
commit 2709252daa
3 files changed
+13 -2

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
// `node --test` with the files run side by side capped at 8 and at one per
// spare core. A flat 8 kept a big machine from swamping the page tests, but on
// a 3 or 4 core CI runner it ran 8 browsers at once, nearly triple Node's own
// default, and page tests timed out at random. Arguments pass straight through.
import { spawnSync } from "node:child_process";
import os from "node:os";
const concurrency = Math.max(1, Math.min(8, os.availableParallelism() - 1));
const r = spawnSync(process.execPath, ["--test", `--test-concurrency=${concurrency}`, ...process.argv.slice(2)], { stdio: "inherit" });
process.exit(r.status ?? 1);