Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup - include all ignored envs
  • Loading branch information
BridgeAR committed Jan 24, 2020
commit 5b44ea9080a449d7eb0842b97a2b6c20c1718785
12 changes: 8 additions & 4 deletions lib/internal/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ let warned = false;
function warnOnDeactivatedColors(env) {
if (warned)
return;
let name;
let name = '';
if (env.NODE_DISABLE_COLORS !== undefined)
name = 'NODE_DISABLE_COLORS';
if (env.NO_COLOR !== undefined)
name = 'NO_COLOR';
if (env.NO_COLOR !== undefined) {
if (name !== '') {
name += "' and '";
}
name += 'NO_COLOR';
}

if (name !== undefined) {
if (name !== '') {
process.emitWarning(
`The '${name}' env is ignored due to the 'FORCE_COLOR' env being set.`,
'Warning'
Expand Down
3 changes: 2 additions & 1 deletion test/pseudo-tty/test-tty-color-support-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

require('../common');

process.env.NODE_DISABLE_COLORS = 1;
process.env.NO_COLOR = '1';
process.env.NODE_DISABLE_COLORS = '1';
process.env.FORCE_COLOR = '3';

console.log();
2 changes: 1 addition & 1 deletion test/pseudo-tty/test-tty-color-support-warning.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

(node:*) Warning: The 'NODE_DISABLE_COLORS' env is ignored due to the 'FORCE_COLOR' env being set.
(node:*) Warning: The 'NODE_DISABLE_COLORS' and 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.