Skip to content

Commit cb20cc5

Browse files
committed
fix(test): strip ANSI codes when checking for arrow symbols in step test
The test was counting all → and > characters including those in ANSI color codes, causing it to fail in CI. Now strips ANSI codes before validation.
1 parent d9d0909 commit cb20cc5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/logger.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,14 @@ describe('Logger', () => {
391391

392392
it('should strip existing symbols from step message', () => {
393393
testLogger.step('→ Step 1')
394-
const output = stdoutChunks.join('')
395-
// Should have the symbol added by step(), not doubled
396-
const arrowCount = (output.match(/[>]/g) || []).length
394+
// Get the last chunk (the actual step line, not the blank line)
395+
const stepLine = stdoutChunks[stdoutChunks.length - 1]
396+
// Strip ANSI color codes for easier testing
397+
const stripped = stepLine.replace(/\x1b\[\d+m/g, '')
398+
// Should have exactly one arrow symbol and the message text
399+
expect(stripped).toMatch(/^[>] Step 1\n$/)
400+
// Verify the arrow appears exactly once at the start
401+
const arrowCount = (stripped.match(/[>]/g) || []).length
397402
expect(arrowCount).toBe(1)
398403
})
399404

0 commit comments

Comments
 (0)