Skip to content

Commit f94336f

Browse files
MoLowrichardlau
authored andcommitted
repl: fix NO_COLORS env var is ignored
PR-URL: #51568 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 1dae187 commit f94336f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

‎lib/repl.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ function REPLServer(prompt,
302302

303303
if(options.terminal&&options.useColors===undefined){
304304
// If possible, check if stdout supports colors or not.
305-
options.useColors=shouldColorize(options.output)||process.env.NODE_DISABLE_COLORS===undefined;
305+
options.useColors=shouldColorize(options.output);
306306
}
307307

308308
// TODO(devsnek): Add a test case for custom eval functions.

‎test/parallel/test-repl-envvars.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const{REPL_MODE_SLOPPY, REPL_MODE_STRICT } = require('repl');
1313
consttests=[
1414
{
1515
env: {},
16-
expected: {terminal: true,useColors: true}
16+
expected: {terminal: true,useColors: false}
1717
},
1818
{
1919
env: {NODE_DISABLE_COLORS: '1'},
@@ -29,7 +29,7 @@ const tests = [
2929
},
3030
{
3131
env: {TERM: 'dumb'},
32-
expected: {terminal: true,useColors: true}
32+
expected: {terminal: true,useColors: false}
3333
},
3434
{
3535
env: {TERM: 'dumb',FORCE_COLOR: '1'},
@@ -41,15 +41,15 @@ const tests = [
4141
},
4242
{
4343
env: {NODE_NO_READLINE: '0'},
44-
expected: {terminal: true,useColors: true}
44+
expected: {terminal: true,useColors: false}
4545
},
4646
{
4747
env: {NODE_REPL_MODE: 'sloppy'},
48-
expected: {terminal: true,useColors: true,replMode: REPL_MODE_SLOPPY}
48+
expected: {terminal: true,useColors: false,replMode: REPL_MODE_SLOPPY}
4949
},
5050
{
5151
env: {NODE_REPL_MODE: 'strict'},
52-
expected: {terminal: true,useColors: true,replMode: REPL_MODE_STRICT}
52+
expected: {terminal: true,useColors: false,replMode: REPL_MODE_STRICT}
5353
},
5454
];
5555

‎test/parallel/test-repl-options.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ assert.strictEqual(r1.output, stream);
5555
assert.strictEqual(r1.input,r1.inputStream);
5656
assert.strictEqual(r1.output,r1.outputStream);
5757
assert.strictEqual(r1.terminal,true);
58-
assert.strictEqual(r1.useColors,r1.terminal);
58+
assert.strictEqual(r1.useColors,false);
5959
assert.strictEqual(r1.useGlobal,false);
6060
assert.strictEqual(r1.ignoreUndefined,false);
6161
assert.strictEqual(r1.replMode,repl.REPL_MODE_SLOPPY);

0 commit comments

Comments
(0)