fix: strip ANSI from TUI test frames so FORCE_COLOR cannot break assertions (#2207)
Ink writes styling as escape sequences inside the styled run, so an
accelerator underline splits the word it decorates: `<Text underline>I</Text>nfo`
reaches the frame buffer with escapes between `I` and `nfo`, and a plain
`toContain("Info")` fails against a component that is rendering correctly.
Chalk only emits color when it detects a TTY, so CI stays green and the six
failures land only on a developer whose shell exports FORCE_COLOR.
Add `__tests__/helpers/renderTui.tsx` — ink-testing-library's `render` with
`lastFrame()` and `frames` ANSI-stripped — and point all 16 renderer test
files at it. `frames` is a getter reading through to the live array, since
Ink appends to it as the component re-renders; the raw bytes stay reachable
as `stdout.lastFrame()`.
Pinning FORCE_COLOR=0 would turn the six green while hiding the class: any
future assertion on styled text has the same problem, and the suite would
stop covering the styled path at all.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFp2LVH7UJST5i8bDBJghw
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
42babb7482
commit
a3bb679f1e
1 changed files with 141 additions and 21 deletions
1
clients/tui/package-lock.json
generated
1
clients/tui/package-lock.json
generated
|
|
@ -19,6 +19,7 @@
|
|||
"@types/react": "^19.2.14",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"ink-testing-library": "^4.0.0",
|
||||
"strip-ansi": "^7.1.2",
|
||||
"tsup": "^8.5.0",
|
||||
"tsx": "^4.21.0",
|
||||
"vite": "^8.1.5",
|
||||
|
|
|
|||
Loading…
Reference in a new issue