Skip to content

Commit 97df780

Browse files
committed
test: fix help style test when FORCE_COLOR is in parent env
The NO_COLOR and alignment-preservation tests inherited FORCE_COLOR from process.env, which takes precedence over NO_COLOR and caused the tests to fail on CI environments where FORCE_COLOR is set. Delete FORCE_COLOR from the child env in those test cases. Signed-off-by: Adrian Estrada <edsadr@gmail.com>
1 parent 8f06ce5 commit 97df780

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

test/parallel/test-cli-node-print-help-style.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function stripAnsi(text) {
2727
// Test: NO_COLOR=1 produces plain output
2828
{
2929
const env = { ...process.env, NO_COLOR: '1' };
30+
delete env.FORCE_COLOR;
3031
execFile(process.execPath, ['--help'], { env },
3132
common.mustSucceed((stdout) => {
3233
assert.ok(stripAnsi(stdout) === stdout,
@@ -51,6 +52,7 @@ function stripAnsi(text) {
5152
{
5253
const envStyled = { ...process.env, FORCE_COLOR: '1' };
5354
const envPlain = { ...process.env, NO_COLOR: '1' };
55+
delete envPlain.FORCE_COLOR;
5456
execFile(process.execPath, ['--help'], { env: envStyled },
5557
common.mustSucceed((styledStdout) => {
5658
execFile(process.execPath, ['--help'], { env: envPlain },

0 commit comments

Comments
 (0)