Skip to content

Switch to disable color output to console #843

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

Closed
otakusid opened this issue May 18, 2016 · 12 comments · Fixed by singapore/gl-got#20
Closed

Switch to disable color output to console #843

otakusid opened this issue May 18, 2016 · 12 comments · Fixed by singapore/gl-got#20
Labels
bug current functionality does not work as desired good for beginner help wanted

Comments

@otakusid
Copy link

it would be good to have a switch that disable colors in console output f.e --no-color

it was useful when ava used under some CI systems f.e. TeamCity and color coding showed as plain text in test reports.

pasted image at 2016_05_18 03_54 pm

@sindresorhus
Copy link
Member

sindresorhus commented May 18, 2016

Yeah, it should already work, but trying it out now it doesn't. We'll look into it. We're probably just not passing the flag down to the spawned test file.

Also, please open up an issue on https://github.com/chalk/supports-color with the output of running node -p 'process.env' (ensure you scrub any sensitive info) in TeamCity so we can try to disable colors automatically for you.

@sindresorhus sindresorhus added bug current functionality does not work as desired help wanted good for beginner labels May 18, 2016
@otakusid
Copy link
Author

done :)

chalk/supports-color#37

@vadimdemedes
Copy link
Contributor

Submitted a PR to fix this - chalk/supports-color#39.

@vadimdemedes
Copy link
Contributor

Oh damn, did not see the "good for beginner" badge... Sorry!

@sindresorhus
Copy link
Member

@vdemedes No worries. The beginner badge is for fixing the --no-color flag in AVA.

@simonbuchan
Copy link

Obv. this should still be done, but is the OP using TeamCIty 9.1+? Colored output was supported with https://youtrack.jetbrains.com/issue/TW-23760

@ThomasBem
Copy link
Contributor

As far as I can tell this issue has been made available again because of lack of activity in #1104. So I would like to see if I can finish up what @thinkimlazy started on.

@novemberborn
Copy link
Member

@ThomasBem go for it!

@sindresorhus sindresorhus changed the title switch to disable color output to console Switch to disable color output to console Jan 16, 2017
@thinkimlazy
Copy link

@ThomasBem great! I think u need to check if main proccess has color flag disabled, then pass it to child test proccesses. And write tests. GL!

@ThomasBem
Copy link
Contributor

I got it to work for the mini and verbose test reporters already. Gotten quiet familiar with those two from my recent issues / PR`s. Combined with the work you had already done that went really fast. Now I gotta figure out how to stop it from printing color in the tests themselves.

So gotta read some more code! :)

@aemixdp
Copy link

aemixdp commented Apr 1, 2017

Still doesn't work correctly in 0.18.2:

import test from 'ava';

test('Test', (t) => {
    t.is(1, 2);
});
$ ava --verbose --no-color > test.log 2>&1
$ open test.log
  × Test  

  1 test failed [20:29:45]

  Test
  D:\Code\js\ava-sandbox\test.js:4

   3: test('Test', (t) => {
   4:     t.is(1, 2);      
   5: });                  

  Actual:

     [33m1[39m

  Expected:

     [33m2[39m

novemberborn added a commit that referenced this issue Apr 2, 2017
Fixes #843
(#843 (comment)). Values
shouldn't be highlighted during formatting if colors are disabled.
novemberborn added a commit that referenced this issue Apr 2, 2017
Fixes #843
(#843 (comment)). Values
shouldn't be highlighted during formatting if colors are disabled.
@novemberborn
Copy link
Member

@aemxdp interesting. #1334 should fix that.

novemberborn added a commit that referenced this issue Apr 3, 2017
Fixes #843
(#843 (comment)). Values
shouldn't be highlighted during formatting if colors are disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired good for beginner help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants