-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Using chalk in AVA tests does not colorize the strings #1124
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
Comments
// @thinkimlazy |
Ye that what I meant. Mine test files with no colors, but my terminal supports color. Sindre got colors. |
@sindresorhus @thinkimlazy what is the actual bug here? Is it AVA overriding the |
I figure out the problem. It's in the Windows follow this (or something similar, up to Windows 8): |
This is what's working for me on windows: |
@unional We do literally the exact same thing. Nobody else has reported any issues on Windows until this bug. There's no difference here. This is probably a configuration issue happening inside of AVA. |
Mentioned on the To see the difference: npm i -g ava
npm i chalk ava aurelia-logging aurelia-logging-color // index.js
var chalk = require('chalk')
var logging = require('aurelia-logging')
var color = require('aurelia-logging-color')
var test = require('ava')
logging.setLevel(logging.logLevel.debug)
var log = logging.getLogger('some log')
logging.addAppender(new color.ColorAppender())
test(_t => {
console.log(chalk.bgGreen('suppose to be green'))
log.debug('log something')
}) ava index.js |
It is the same. Check |
Ok. You are correct. I do see that When I worked on However, right now I can't reproduce the problem. Everything seems to be working fine for As for the OP, I tried var chalk = require('chalk')
var test = require('ava')
chalk.enabled = true
test(_t => {
console.log(`bgBlue: ${chalk.bgBlue('bgBlue')} and yellow: ${chalk.yellow('yellow')}`)
console.log(chalk.bgCyan('cyan'), chalk.bgGreen('green'))
}) |
Closing as this is working now. |
'chalk' is using the 'supports-color' module which reads process.stdout.isTTY as soon as it is required. Since our process-adapter is initializing a fake TTY support, we must ensure that 'supports-color' is not executed before our fake TTY support is initialized. avajs#1124
I noticed that the following code does work as expected
but this doesn't
I'm using ava 0.17.0 and chalk 1.1.3.
The text was updated successfully, but these errors were encountered: