- Notifications
You must be signed in to change notification settings - Fork 1.4k
Add --no-color flag - fixes #843 #1098
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
Conversation
| @thinkimlazy thanks for your PR. Reading #843 I can't determine whether @sindresorhus wanted this fixed in |
| @novemberborn Hey, thats not working ideally as you want because of this code in verbose/mini reporters: So when |
| Killing those |
| @novemberborn from my perspective of that conversation in the issue, it looks like both a fix in the supports-color module as well as ava were sought after (ava being the flag needs to be passed down and supports-color needing teamcity <9 support). |
sindresorhus left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need a test of both the AVA output and chalk used in a test.
| } | ||
| | ||
| if ( | ||
| hasFlag('--no-color') || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect. It should be:
cli.flags.color === false| ) { | ||
| chalk.enabled = false; | ||
| Object.keys(colors).forEach(function (key) { | ||
| colors[key].enabled = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think chalk.enabled = false should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually. None of this should be needed as chalk already supports the --no-color flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What actually needs to be done is to pass the flag down to the forked process.
| ], | ||
| "babel": "inherit" | ||
| "babel": "inherit", | ||
| "noColor": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"color": false --no-color flag - fixes #843 --no-color flag - fixes #843--no-color flag - fixes #843 | @thinkimlazy Why did you close? |
| @sindresorhus sry, I messed up |
| @thinkimlazy You never have to open a new PR. That just creates noise in the issue tracker. You can always reset the state of an existing PR and start over if you really messed up. |
| @sindresorhus I can't reopen this one because I recreated my branch. Again sorry for spam |
| No worries :) |
Disables color output with
--no-coloroption for CLI and"noColor": truefor package.jsonResolves #843