Closed sramam closed 4 years ago
The "TTY"-nesh of a worker process no longer mimicks the environment you start AVA in. This proved too difficult to maintain.
https://github.com/avajs/ava/issues/2343 discusses publishing our fake implementation as its own package, which you could then load.
Alternatively you can configure a Chalk instance to force colors to be available.
I'd just like to say, thank you for putting the v3 beta through its paces!
(I'm closing this issue for housekeeping purposes, but let's keep the conversation going.)
Alternatively you can configure a Chalk instance to force colors to be available.
Could you explain how to do this? I'm looking for the quickest win in the moment.
Assuming latest chalk
:
const { Instance } = require('chalk')
const chalk = new Instance({level: 3})
Oh - I get this - but where - in each test suite? in lib/concordance-options.js (v3.0), I logged the level
console.log(`chalk: ${Math.max(chalk.level, 1)} forceColor.level: ${forceColor.level}`);
and it is being reported as 3.
No the chalk
you're using in your test.
ah! This seems to be a side-effect of upgrading chalk!
Not sure I understand why the default level of chalk is getting set to zero - but that's a discussion for another day on another repo.
I'd also like you thank you for a wonderful test runner and all the work you do to move it forward. My value-add to the beta was incidental - I just have a complex application with a lot of tests, so a simple migration kept surfacing issues. Your effort requires dedication to the cause and is deeply appreciated!.
ah! This seems to be a side-effect of upgrading chalk!
Not sure I understand why the default level of chalk is getting set to zero - but that's a discussion for another day on another repo.
No I think it's due to our changes in AVA 3. Before, we kinda made it look like the worker process supported colors. We no longer do. Therefore, your Chalk thinks it doesn't.
And thanks 😄
Assuming latest
chalk
:const { Instance } = require('chalk') const chalk = new Instance({level: 3})
Originally posted by @novemberborn in https://github.com/avajs/ava/issues/2367#issuecomment-574597756
This is now:
import { Chalk } from "chalk"
const chalk = new Chalk({ level: 3 });
Edit: This workaround doesn't work for me somehow.
Description
The behavior of how chalk'd output is handled has changed w.r.t. snapshots. Took me a while to pin this on 3.0.0.
Use case: I snapshot the CLI output as an easy way to track changes over time. This includes all Ansi-control chars. v3 snapshots seem to strip all ansi-control characters from snapshots.
I did not see an obvious cause in the code, but please do not remove this ability, it will cause me a lot of grief.
Test Source
Test case
Results in a snapshot mismatch.
Snapshot.md - version 2
Snapshot.md - version 3