Skip to content

feat(cli): respect NO_COLOR environment variable per no-color.org#12

Open
lxcario wants to merge 1 commit into
TestSprite:mainfrom
lxcario:feat/no-color-support
Open

feat(cli): respect NO_COLOR environment variable per no-color.org#12
lxcario wants to merge 1 commit into
TestSprite:mainfrom
lxcario:feat/no-color-support

Conversation

@lxcario

@lxcario lxcario commented Jun 23, 2026

Copy link
Copy Markdown

The CLI uses ANSI escape codes for the TTY progress ticker (\x1b[2K\r). The NO_COLOR standard says tools should suppress color/ANSI output when NO_COLOR env is set.

Changes

  • Added isNoColor() utility in src/lib/ticker.ts that checks for NO_COLOR in the environment
  • When NO_COLOR is set and the terminal is a TTY, the ticker emits plain-text lines via stderrWrite instead of using ANSI escape sequences via rawWrite
  • Added a 4th optional noColor parameter to createTicker() (defaults to env detection)
  • Added NO_COLOR to the environment variables table in DOCUMENTATION.md
  • Added 5 new tests (3 for NO_COLOR ticker behavior + 2 for isNoColor utility)

Testing

  • npm run typecheck - clean
  • npm run lint:fix - clean
  • npx vitest run src/lib/ticker.spec.ts - 19/19 passing (all existing + 5 new)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant