Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colors from tests results are not displayed in ghciwatch output #330

Open
jaredramirez opened this issue Nov 7, 2024 · 3 comments
Open
Labels
linear Created by Linear-GitHub Sync

Comments

@jaredramirez
Copy link

What happened?

When running a test suite (hspec) with ghciwatch with the following command:

ghciwatch
    --command "cabal repl my-app-test --repl-options=-fdiagnostics-color=always"
    --watch app --watch src --watch test
    --test-ghci "Spec.main"
    --clear

Colors to not appear in the test output.

In addition to passing in -fdiagnostics-color=always thru a cli option, I have added it to ghc-options in my-app.cabal and project.cabal:

-- my-app.cabal
test-suite my-app-test
     ...
     ghc-options: -Wwarn -fdiagnostics-color=always

-- project.cabal
packages: christmas-gift-drawing.cabal
multi-repl: True
package *
  ghc-options: -fdiagnostics-color=always

What did you expect to happen?

I expected the colored output from the test to be visible in ghciwatch. Here's a screenshot of the output:

Screenshot 2024-11-06 at 4 59 02 PM

Here's what I would expect the it to look like (via ghcid):
Screenshot 2024-11-06 at 4 59 18 PM

Steps to reproduce the issue

I think there's enough info above!

The version of ghciwatch with the bug

ghciwatch 1.0.1

@github-actions github-actions bot added the linear Created by Linear-GitHub Sync label Nov 7, 2024
@9999years
Copy link
Member

Hmmm, you might need to tweak something in your test suite runner (ghciwatch captures output so it might be seeing that stderr is not a tty or whatever), or this might be a more fixable bug with ANSI escape handling...

@chreekat
Copy link

chreekat commented Dec 6, 2024

I was going to open an issue myself for another problem with colors -- maybe related?

If I run https://github.com/chreekat/cubectl , the main function prints a bunch of lo-tech tests. One of them is pretty-printing that involves a bunch of color.

In the screenshot below, there are two tmux panes.

  • In the upper one is the output of running main from cabal repl.
  • The lower pane has the output of ghciwatch --command "cabal repl ." --watch . --error-file errors.err --clear --test-ghci main

Since the color blocks are just a space character with colored background, nothing shows up at all in ghciwatch.

image

@9999years
Copy link
Member

Thanks, that's a helpful test case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

3 participants