You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The option --color=always should keep ANSI codes when output is sent to a pipe.
Instead, when running a test, the green texts ok, and the red texts FAILED are not colored.
Steps
Create a project using cargo new dummy --lib.
Type cargo --color=always test | more.
The text ok appears three times not colored, instead of dark green.
Possible Solution(s)
No response
Notes
Test output is directed to stdout, while normal cargo output goes to stderr. It appears that ANSI codes are kept only for stderr.
Thanks for the report! The issue is that the tests are handled by a separate process with its own CLI and environment variables. To force color for the tests, too, you need to pass the color option to the test harness as in:
Problem
The option
--color=always
should keep ANSI codes when output is sent to a pipe.Instead, when running a test, the green texts
ok
, and the red textsFAILED
are not colored.Steps
Create a project using
cargo new dummy --lib
.Type
cargo --color=always test | more
.The text
ok
appears three times not colored, instead of dark green.Possible Solution(s)
No response
Notes
Test output is directed to stdout, while normal cargo output goes to stderr. It appears that ANSI codes are kept only for stderr.
Version
The text was updated successfully, but these errors were encountered: