perf(runtime-tests): run PTY tests file-parallel across forked workers

The PTY suite was the CI wall-clock bottleneck, run serially via
fileParallelism:false. The original reason for serializing was a node-pty
constraint — it needs child_process.fork(), not worker_threads — but that only
dictates the pool TYPE, not single-file execution. Each test already spawns its
own isolated PTY subprocess (helpers/term.ts, run.ts: no shared ports, temp
files, or mutable globals; cwd is the read-only fixtures dir), so files
parallelize safely.

Set pool:"forks" explicitly (the real node-pty requirement) and
fileParallelism:true. Measured: the PTY suite drops ~37s -> ~13s (~3x), and the
full `vp run ci` graph drops ~41s -> ~20s cold (no task cache, no prebuilt
dist). Verified stable across 9 isolated PTY runs (incl. maxForks capped to 4
to mimic a 4-core CI runner) and 3 cold full-graph runs — 110 PTY tests pass
every time, zero flakes. testTimeout stays 15s (slowest test ~2s) to absorb CPU
contention on smaller runners.
This commit is contained in:
Yunfei He
2026-05-29 11:28:36 +08:00
parent bdadea0d02
commit 2fef2f3a3b
+8 -1
View File
@@ -5,7 +5,14 @@ export default defineConfig({
plugins: [vueJsx()],
test: {
include: ["integration/pty/**/*.test.{ts,tsx}"],
fileParallelism: false,
// node-pty requires child_process.fork(), not worker_threads, so the pool
// MUST be "forks". Each test spawns its own isolated PTY subprocess (no
// shared ports/files/global state), so test files parallelize safely across
// forked workers — ~3x faster than serial (the PTY suite is the CI's
// wall-clock bottleneck). testTimeout stays generous (15s vs ~2s slowest
// test) to absorb CPU contention on smaller CI runners.
pool: "forks",
fileParallelism: true,
testTimeout: 15000,
env: { FORCE_COLOR: "3" },
},