Strip the ISO timestamp prefix that ticker prepends to every line.
(raw: string)
| 42 | |
| 43 | /** Strip the ISO timestamp prefix that ticker prepends to every line. */ |
| 44 | function stripTickerTimestamp(raw: string): string { |
| 45 | // Format: "\x1b[2K\r<ISO-TS> <content>" → "\x1b[2K\r<content>" |
| 46 | // Use a string replace to avoid the no-control-regex lint rule. |
| 47 | const prefix = '\x1b[2K\r'; |
| 48 | if (!raw.startsWith(prefix)) return raw; |
| 49 | // The content after the escape sequence starts with an ISO timestamp like |
| 50 | // "2026-05-21T12:34:56.789Z "; strip it by cutting at the first space |
| 51 | // following the "Z" terminator. |
| 52 | const afterEsc = raw.slice(prefix.length); |
| 53 | const spaceIdx = afterEsc.indexOf(' '); |
| 54 | if (spaceIdx === -1) return raw; |
| 55 | return prefix + afterEsc.slice(spaceIdx + 1); |
| 56 | } |
| 57 | |
| 58 | describe('createTicker — TTY mode', () => { |
| 59 | it('update writes ANSI clear-line + carriage-return + content via rawWrite', () => { |