tty: add NO_COLOR and FORCE_COLOR support · nodejs/node@8cafd83 (original) (raw)

`@@ -59,11 +59,18 @@ const writeStream = new WriteStream(fd);

`

59

59

`[{ TERM: 'color' }, 4],

`

60

60

`[{ TERM: 'linux' }, 4],

`

61

61

`[{ TERM: 'fail' }, 1],

`

62

``

`-

[{ NODE_DISABLE_COLORS: '1' }, 1],

`

``

62

`+

[{ TERM: 'color', NODE_DISABLE_COLORS: '1' }, 1],

`

63

63

`[{ TERM: 'dumb' }, 1],

`

64

64

`[{ TERM: 'dumb', COLORTERM: '1' }, 1],

`

65

65

`[{ TERM: 'terminator' }, 24],

`

66

``

`-

[{ TERM: 'console' }, 4]

`

``

66

`+

[{ TERM: 'console' }, 4],

`

``

67

`+

[{ COLORTERM: '24bit', FORCE_COLOR: '' }, 4],

`

``

68

`+

[{ NO_COLOR: '1', FORCE_COLOR: '2' }, 8],

`

``

69

`+

[{ NODE_DISABLE_COLORS: '1', FORCE_COLOR: '3' }, 24],

`

``

70

`+

[{ NO_COLOR: '1', COLORTERM: '24bit' }, 1],

`

``

71

`+

[{ NO_COLOR: '', COLORTERM: '24bit' }, 1],

`

``

72

`+

[{ TMUX: '1', FORCE_COLOR: 0 }, 1],

`

``

73

`+

[{ NO_COLOR: 'true', FORCE_COLOR: 0, COLORTERM: 'truecolor' }, 1],

`

67

74

`].forEach(([env, depth], i) => {

`

68

75

`const actual = writeStream.getColorDepth(env);

`

69

76

`assert.strictEqual(

`