-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: support FORCE_COLOR
for non TTY streams
#48034
Conversation
Review requested:
|
test/parallel/test-repl-envvars.js
Outdated
@@ -72,4 +81,4 @@ function run(test) { | |||
}); | |||
} | |||
|
|||
tests.forEach(run); | |||
tests.forEach((testCase) => test(inspect(testCase.env), () => run(testCase))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests did not play well when running in parallel. used node:test
to run them sequentially
/CC @nodejs/util @nodejs/console |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This broke tests when pulling into v18, so it needs a backport. |
@danielleadams It seems |
Talked to @MoLow offline, but staging branch is ready for backport now. |
PR-URL: nodejs#48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs#48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs#48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs#48034 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@MoLow Small heads up, this seems to have broken |
@addaleax I am not able to reproduce this: |
@MoLow Yeah, |
This was historically done to make `console.log()` have colors. However, this makes any other code that checks `process.stdout.isTTY` incorrectly assume real TTY support. Node18 and Node20 now respect `FORCE_COLOR=1` in console, so our default behavior of forcing colors in the worker process just works out of the box. See nodejs/node#48034.
The current behavior of
FORCE_COLOR
is to take effect whenstdout
/stderr
are TTY'saccording to the documentation:
this PR moves the check for the value of
FORCE_COLOR
before testingisTTY
- and extracts the logic to a central utility.Refs: #31409 (comment)