MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / stripTickerTimestamp

Function stripTickerTimestamp

src/lib/ticker.spec.ts:44–56  ·  view source on GitHub ↗

Strip the ISO timestamp prefix that ticker prepends to every line.

(raw: string)

Source from the content-addressed store, hash-verified

42
43/** Strip the ISO timestamp prefix that ticker prepends to every line. */
44function 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
58describe('createTicker — TTY mode', () => {
59 it('update writes ANSI clear-line + carriage-return + content via rawWrite', () => {

Callers 1

ticker.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected