Skip to content

Commit b956653

Browse files
committed
Revert "Fix: CLI flags and FORCE_COLOR should precede other color support checks (#154)"
This reverts commit edc5d7d.
1 parent c214314 commit b956653

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
7777

7878
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
7979

80-
if (forceColor !== undefined) {
81-
return forceColor;
80+
if (forceColor === 0) {
81+
return 0;
8282
}
8383

8484
if (sniffFlags) {
@@ -103,7 +103,7 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
103103
return 0;
104104
}
105105

106-
const min = 0;
106+
const min = forceColor || 0;
107107

108108
if (env.TERM === 'dumb') {
109109
return min;

test.js

-16
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,6 @@ test('return true if `FORCE_COLOR` is in env, but honor 256 #2', async t => {
5252
t.is(result.stdout.level, 2);
5353
});
5454

55-
test('CLI color flags precede other color support checks', async t => {
56-
process.env.COLORTERM = 'truecolor';
57-
process.argv = ['--color=256'];
58-
const result = await importMain();
59-
t.truthy(result.stdout);
60-
t.is(result.stdout.level, 2);
61-
});
62-
63-
test('`FORCE_COLOR` environment variable precedes other color support checks', async t => {
64-
process.env.COLORTERM = 'truecolor';
65-
process.env.FORCE_COLOR = '2';
66-
const result = await importMain();
67-
t.truthy(result.stdout);
68-
t.is(result.stdout.level, 2);
69-
});
70-
7155
test('return false if `FORCE_COLOR` is in env and is 0', async t => {
7256
process.env.FORCE_COLOR = '0';
7357
const result = await importMain();

0 commit comments

Comments
 (0)