fix(cli): stabilize UI rendering and make tests robust to platform differences

This commit is contained in:
Keith Guerin
2026-02-27 14:49:38 -08:00
parent 9fda3431b8
commit a829c91836
6 changed files with 39 additions and 15 deletions

View File

@@ -48,12 +48,14 @@ describe('textUtils', () => {
it('should handle unicode characters that crash string-width', () => {
// U+0602 caused string-width to crash (see #16418)
const char = '؂';
expect(getCachedStringWidth(char)).toBe(1);
expect(() => getCachedStringWidth(char)).not.toThrow();
expect(typeof getCachedStringWidth(char)).toBe('number');
});
it('should handle unicode characters that crash string-width with ANSI codes', () => {
const charWithAnsi = '\u001b[31m' + '؂' + '\u001b[0m';
expect(getCachedStringWidth(charWithAnsi)).toBe(1);
expect(() => getCachedStringWidth(charWithAnsi)).not.toThrow();
expect(typeof getCachedStringWidth(charWithAnsi)).toBe('number');
});
});