Open
Description
Re-opening this to ensure it doesn't get overlooked. Test case copied from #41 (comment). Fixed in #41, but the patch was modified, which introduced the new bug.
In the current version (1.2.0) of Colorette, the following all have the same effect:
FORCE_COLOR=1
FORCE_COLOR=0
FORCE_COLOR=
i.e. FORCE_COLOR=<falsey/no value>
incorrectly forces color which wouldn't otherwise be displayed.
test.js
const { green } = require('colorette')
console.log(green('Hello, world!'))
1) expect color
$ FORCE_COLOR=1 node ./test.js | strings
output ✔
[32mHello, world!
[39m
2) expect no color (because of the pipe)
$ node ./test.js | strings
output ✔
Hello, world!
3) expect no color (same as 2)
$ FORCE_COLOR=0 node ./test.js | strings
output ❌ 🐛
[32mHello, world!
[39m
4) expect no color (same as 2)
$ FORCE_COLOR= node ./test.js | strings
output ❌ 🐛
[32mHello, world!
[39m
Metadata
Assignees
Labels
No labels