test(runtime-tests): run the main suite concurrently by default

Enable sequence.concurrent: true in vite.config.ts so the non-PTY suite runs
concurrently like the PTY suite. Stress-verified stable (8/8 at maxForks=4);
the suite drops from ~13s to ~4-5s.

Three test patterns were incompatible with concurrency; handled per cause:

- Inline snapshots (background-color, borders): the module-level `expect`
  loses snapshot test context under concurrency. Fixed in place by using the
  context-local `expect` (async ({ expect }) => ...), so they stay concurrent.

- Process-global state (throttle/animation-scheduler use fake timers; leak
  asserts on process exit/SIGINT listener counts and live yoga nodes): a
  concurrent sibling clobbers the shared global mid-test. These genuinely
  require serial execution, so they move to *.sequential.test.* files with
  it.sequential / describe.sequential and a header explaining why.

`vp run ready` passes.
This commit is contained in:
Yunfei He
2026-05-29 14:10:27 +08:00
parent fa626dc90f
commit ee6004b8be
6 changed files with 125 additions and 102 deletions
+4
View File
@@ -6,6 +6,10 @@ export default defineConfig({
test: {
// chalk disables color in non-TTY envs; force it on so ANSI style bugs don't hide from tests
env: { FORCE_COLOR: "3" },
// Tests run concurrently by default. Tests that genuinely need serial
// execution (process-global fake timers) live in their own *.sequential
// files. Snapshot tests stay concurrent by using the context-local expect.
sequence: { concurrent: true },
// PTY tests run separately via vitest.pty.config.ts (they need node-pty's forks pool and a longer timeout)
exclude: ["integration/pty/**", "node_modules/**"],
},