Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 10, 2025

  • Explored repository structure and understood leeway is a build system for Go, Yarn and Docker projects
  • Built project successfully (though with long download times)
  • Discovered failing test TestConsoleReporter in pkg/leeway/reporter_test.go
  • Identified the bug: Console reporter outputs ANSI color codes even when writing to buffers during tests
  • Analyzed the issue: The test expects plain text but gets text with color escape sequences
  • Found root cause: gookit/color package's global Enable variable controls color rendering but is always on
  • Fixed the bug by adding conditional color rendering based on output destination
  • Implemented shouldUseColor() method to detect if output is going to stdout vs buffer
  • Added colorSprintf() helper method that strips color tags for non-TTY output
  • Updated all color usage in ConsoleReporter to use conditional rendering
  • Verified the fix passes all ConsoleReporter tests
  • Run full test suite to ensure no regressions - all tests pass
  • Final validation that colors still work for actual console output
  • Built and tested final binary - works correctly

Summary: Fixed a bug where the ConsoleReporter in the leeway build system was outputting ANSI color escape codes even when writing to test buffers, causing test failures. The solution adds intelligent color detection that only enables colors when outputting to stdout (real console) but disables them when outputting to buffers during tests.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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.

2 participants