You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there's a difference with --test, because process.env.FORCE_COLOR is set to 1. In this case: the shouldColorize() method forces the color (by getColorDepth() unless FORCE_COLOR is different from '', '1', 'true', '2' and '3').
I don't think you should force color when it's supported. It should be the functions that stylize the test results that should call shouldColorize() to check whether they are adding color. This already seems to be the case in lib/internal/test_runner/reporter/utils.js.
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
Activity
regseb commentedon Apr 18, 2025
I think there's a difference with
--test, becauseprocess.env.FORCE_COLORis set to1. In this case: theshouldColorize()method forces the color (bygetColorDepth()unlessFORCE_COLORis different from'','1','true','2'and'3').node/lib/internal/util/colors.js
Lines 18 to 25 in 6cdcaa9
I think it's this line that forces the color:
node/lib/internal/test_runner/runner.js
Lines 375 to 377 in 6cdcaa9
The
shouldColorizeTestFiles()method usesshouldColorize().node/lib/internal/test_runner/utils.js
Lines 145 to 151 in 6cdcaa9
I don't think you should force color when it's supported. It should be the functions that stylize the test results that should call
shouldColorize()to check whether they are adding color. This already seems to be the case in lib/internal/test_runner/reporter/utils.js.github-actions commentedon Apr 20, 2026
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
regseb commentedon Apr 20, 2026
I tested it with Node v25.9.0 and I'm still having the problem.
github-actions commentedon Jul 20, 2026
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
regseb commentedon Jul 28, 2026
The problem still exists in Node v26.5.0
lib,test_runner: fix styleText colorizing non-TTY streams under --test