Skip to content

Conversation

@AdAstraAbyssoque
Copy link

@AdAstraAbyssoque AdAstraAbyssoque commented Jan 29, 2026

Summary

This PR fixes the tests in cli/src/color.rs. The original tests never called the real color helpers, so they only validated format! output rather than the actual logic. The updated tests now exercise red() / green() and assert behavior based on NO_COLOR.

Why this change

Previously, the tests did:

  • format!("\x1b[31m{}...", "error")
  • never invoked red() / green()

As a result:

  • the tests would pass even if the helper functions were broken
  • the real behavior (respecting NO_COLOR) was never validated

What changed

  • test_red_contains_ansi_codes now calls red(text) and checks ANSI prefix/reset when enabled, or plain text when disabled
  • test_green_contains_ansi_codes now calls green(text) and validates actual output
  • no production logic changed, only tests

Test plan

  • cargo test color --manifest-path cli/Cargo.toml

Ensure color tests call the real formatting helpers so they
actually validate the NO_COLOR behavior instead of only
checking format! output.
Copilot AI review requested due to automatic review settings January 29, 2026 08:26
@vercel
Copy link
Contributor

vercel bot commented Jan 29, 2026

@AdAstraAbyssoque is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the tests in cli/src/color.rs to actually call the red() and green() color helper functions instead of just testing format! output. The original tests never validated the actual logic that respects the NO_COLOR environment variable.

Changes:

  • Updated test_red_contains_ansi_codes to call red() and check output based on is_enabled()
  • Updated test_green_contains_ansi_codes to call green() and validate actual output
  • No production code changes, only test improvements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AdAstraAbyssoque
Copy link
Author

According to the suggestions from @copilot , we make updates to avoid NO_COLOR caching during tests and add env-guarded
coverage for both colored and non-colored paths.

Avoid NO_COLOR caching during tests and add env-guarded
coverage for both colored and non-colored paths.
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