Skip to content

fix: respect NO_COLOR and non-TTY output for --check diffs - #996

Open
bmish wants to merge 1 commit into
mainfrom
fix/check-diff-no-color
Open

fix: respect NO_COLOR and non-TTY output for --check diffs#996
bmish wants to merge 1 commit into
mainfrom
fix/check-diff-no-color

Conversation

@bmish

@bmish bmish commented Jul 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Honor NO_COLOR / non-TTY stderr (and FORCE_COLOR) when printing --check diffs from jest-diff, so CI and redirected logs no longer get unconditional ANSI.
  • Add a regression test that stubs NO_COLOR=1 and asserts stderr contains no ESC sequences.
  • Document the behavior on the README --check option row.

Test plan

  • npm run lint
  • npm test
  • Manually: run --check against out-of-date docs with NO_COLOR=1 and confirm plain diffs; with FORCE_COLOR=1 confirm colors still apply

Made with Cursor

Context

From the post-#987 standards audit: the --check diffs from jest-diff are the only ANSI output this tool emits, and they were emitted unconditionally — including into piped CI logs and with NO_COLOR set. Follows the https://no-color.org convention with FORCE_COLOR override, keyed off stderr (diffs go to console.error).

Co-authored-by: Cursor <cursoragent@cursor.com>
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