fix(testing): pin interactive:true in render() so resize/rawMode are deterministic (#171)

render() never set `interactive`, so the runtime derived it as
`!isInCi && Boolean(stdout.isTTY)`. `is-in-ci` is evaluated once at module
import, so consumers running @vue-tui/testing in CI silently got a
non-interactive app: `terminal.resize()` emitted but never re-laid-out (the
resize handler is registered only when interactive), and the lifetime
raw-mode hold never engaged (`terminal.rawMode.current` stayed false) —
breaking both APIs the README advertises.

Pin `interactive: options.interactive ?? true` in the mount options so the
harness is deterministic and independent of ambient CI/TTY detection, and
expose `interactive?: boolean` on RenderOptions so non-interactive behavior
stays testable. Runtime behavior is unchanged.

Add a subprocess test (runtime-tests, sequential — depends on the
process-global CI env baked into the child at import time) that spawns the
BUILT dist with CI=true vs CI=false, renders a bordered Box that fills the
columns, resizes 40→12, and asserts the re-layout happened and raw mode is
held. It fails on origin/main (resize ignored under CI=true) and passes with
the fix.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-06-14 19:25:20 +08:00
committed by GitHub
parent dd1194eb73
commit 71e7d7e2f0
5 changed files with 138 additions and 7 deletions
+1 -1
View File
@@ -17,6 +17,6 @@ export default defineConfig({
exclude: ["integration/pty/**", "node_modules/**"],
},
lint: {
ignorePatterns: ["integration/pty/fixtures/**"],
ignorePatterns: ["integration/pty/fixtures/**", "integration/subprocess-fixtures/*.mjs"],
},
});