Files
vue-tui/packages/runtime-tests/vitest.pty.config.ts
T
Yunfei He 1e9d6d0b82 fix(ci): force CI=false in vitest env so interactive render tests pass
Fifth CI run failed on ~15 resize/throttle/flush tests that pass locally. Root
cause: the GitHub runner sets CI=true, and vue-tui computes
`interactive = !isInCi && isTTY`. With CI=true, interactive is false, so the
resize listener, cursor control, and ANSI erases are never wired up — exactly
the behavior those tests assert. Locally CI is unset, so they passed (the
local-vs-CI trap, reproducible with `CI=true vp test run`).

Set env CI:"false" in both vitest configs. The PTY child helpers already force
CI=false per-spawn for this reason; the in-process suite (and the testing
harness's render()) needs the same. Verified: `CI=true vp run ci` on a fresh
checkout (no dist) now exits 0 with all 756 + 110 tests passing.
2026-05-29 16:54:13 +08:00

29 lines
1.4 KiB
TypeScript

import { defineConfig } from "vite-plus";
import vueJsx from "@vitejs/plugin-vue-jsx";
export default defineConfig({
plugins: [vueJsx()],
test: {
include: ["integration/pty/**/*.test.{ts,tsx}"],
// 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",
// Files parallelize across forked workers (~3x faster than serial — the PTY
// suite is the CI bottleneck). Tests within a file run SERIALLY: many of
// these assert timing-sensitive render/commit counts driven by the ~32ms
// commit throttle, and in-file concurrency starves them of wall-clock on a
// 4-core CI runner (it passes on higher-core dev machines, which is the
// trap). File-level parallelism is the proven, stable win.
fileParallelism: true,
testTimeout: 15000,
// CI:"false" so the runner's CI=true doesn't flip interactive detection off
// for any in-process render tests under this config (the PTY child helpers
// set it per-spawn, but vitest-level tests need it too).
env: { FORCE_COLOR: "3", CI: "false" },
},
});