Commit ab4c19e
fix(test): strip ANSI codes from Ink TUI test assertions (#1301)
Three TUI component tests were broken on main because Ink 6.8.0
emits ANSI escape codes from `<Text dimColor>`, `<Text color=...>`,
and `<GradientText>` even when the renderer is not attached to a TTY.
The affected assertions compare `lastFrame()` against plain strings,
so the ANSI bytes inside the frame caused these to fail:
src/cli/tui/components/__tests__/DeployStatus.test.tsx:
- 'shows "Deploying to AWS" when not complete'
- 'ignores non-resource-event messages (non-I5502 codes)'
(frame contains `\u001b[90m╭…` from <GradientText> + bordered <Box>)
src/cli/tui/components/__tests__/LogPanel.test.tsx:
- 'renders "No output yet" with no other content'
(frame is `\u001b[2mNo output yet\u001b[22m` from <Text dimColor>)
src/cli/tui/components/__tests__/SecretInput.test.tsx:
- 'renders placeholder when value is empty'
(placeholder is split into <Cursor> + <Text dimColor>, so the
literal substring 'sk-...' has ANSI codes between 's' and 'k-...')
Fix: import `strip-ansi` (already a transitive dep, now declared as a
devDependency) and apply it to `lastFrame()` in the four affected
assertions. Other assertions in the same files were left untouched
because they pass through plain log lines / system messages that are
already ANSI-free.
Verified locally:
Before: Test Files 3 failed | 270 passed (273) | Tests 4 failed | 3912 passed (3916)
After: Test Files 273 passed (273) | Tests 3916 passed (3916)
Co-authored-by: Andrés Aguilar <andiaa@amazon.com>1 parent 2f3040a commit ab4c19e
5 files changed
Lines changed: 9 additions & 4 deletions
File tree
- src/cli/tui/components/__tests__
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
0 commit comments