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

Colorful output in Bash terminal does not work (--colors option) #3877

Closed
wzup opened this issue Jun 21, 2017 · 7 comments
Closed

Colorful output in Bash terminal does not work (--colors option) #3877

wzup opened this issue Jun 21, 2017 · 7 comments

Comments

@wzup
Copy link

wzup commented Jun 21, 2017

colors: true doesn't work when provided in jest.config.js.

I use Git Bash on Windows. Jest doesn't color output in my terminal.
I use colors: true in jest.config.js. And it doesn't work.

Colors only works when provided as a command line option

$ npm test -- --colors

Why is it so? I don't want to type anything more than necessary. I want to type npm test and it should work. How to enable this behavior?

BTW, colors: true in package.json doesn't work either.

Unknown option "debug" with value true was found. This is probably a typing mistake. Fixing it will remove this message.

Why so many configs? You have at least three now that do nor work coordinated. How can I use just one simple config file within which I can declare everything needed? I want to declare any configuration just in jest.config.js. No command line options, no package.json options. All in jest.config.js. How can I do it?

And I'm curious.
Why have you made up three different config places with three different sets of config options? Do you provide three different products or just one?

@wzup wzup changed the title Colors do not work Colorful output in Bash terminal does not work (--colors option) Jun 22, 2017
@thymikee
Copy link
Collaborator

That's because --colors is kinda special option, which processed by chalk. Read more about it here: https://github.com/chalk/chalk#chalksupportscolor.

Other than that you should be able to set up all config options through a config file (you can use either jest.config.js or jest key in package.json, but not both). If not, please file a proper issue.

@CodeShaun
Copy link

I had the same frustration, this solution worked for me:
Add it to your package.json scripts -> test.
"scripts": { "test": "jest --colors" },
Hope that helps.

@remsikr
Copy link

remsikr commented Sep 17, 2018

Add export FORCE_COLOR=true into your .bash_profile or .bashrc.

@yamsellem
Copy link

yamsellem commented Nov 22, 2018

@remsikr marvelous!
Forcing color option this way seems hacky, don't you think?

(but it works great anyway!)

"scripts": { "test": "FORCE_COLOR=true jest" } seems the simplest way to go.

@anselmobattisti
Copy link

If you are using docker-compose the soluction provede by @remsikr works!

@KevinGhadyani-minted
Copy link

@yamsellem's solution fixed my issues with Docker-Compose not showing color output.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants