chalk does not produce colored logs if run with --no-worker-threads #3183
-
With this setup:
I'm trying to use chalk to color my log message, e.g.: import test from "ava";
import chalk from "chalk";
test("colors are logged", (t) => {
t.log(chalk.red("this message is in red"));
t.log(chalk.green("this message is in green"));
t.pass();
}); The messages show up correctly colored when I run ava normally: npx ava But if I turn off worker threads the messages end up gray: npx ava --no-worker-threads I have a sample repository here: https://github.com/stevecaldwell77/ava-chalk And here is a StackBlitz link: https://stackblitz.com/github/stevecaldwell77/ava-chalk?file=README.md |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Chalk detects color support based on its environment, my guess is that in a child process it doesn't inherit those details. You should be able to instantiate a Chalk instance that explicitly enables colors, or use environment variables or some of its other override options. AVA does the same internally for its own Chalk instance. |
Beta Was this translation helpful? Give feedback.
Chalk detects color support based on its environment, my guess is that in a child process it doesn't inherit those details. You should be able to instantiate a Chalk instance that explicitly enables colors, or use environment variables or some of its other override options.
AVA does the same internally for its own Chalk instance.