avajs/ava

chalk does not produce colored logs if run with --no-worker-threads

stevecaldwell77 opened this issue · 0 comments

With this setup:

  • packages:
    • ava 5.2.0
    • chalk 4.1.2
    • ts-node 10.9.1
    • typescript 4.9.5
  • Using ts-node for compilation
  • TS configured to use module mode of commonjs

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