test_runner: allow user-defined color themes via NODE_TEST_RUNNER_THEME#58971
test_runner: allow user-defined color themes via NODE_TEST_RUNNER_THEME#58971elvessilvavieira wants to merge 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
|
Hey @elvessilvavieira, thanks for the contribution! Honestly, I don't think we should go down this road for the following reasons:
A user can just decide to use a custom reporter if they want a different output style. I still see value in what you're proposing, and I'm wondering if it could make sense to have a method like https://nodejs.org/api/test.html#assertregistername-fn that allows the user to configure its preferences. WDYT? |
|
Thanks a lot @pmarchini for the feedback So, following your suggestion and the assert.register approach. Do you recommend something like this? |
|
I'm not 100% sure about the function name, but yes, I was thinking about a similar API! 🚀 |
Thanks again. I'll implement it |
|
FWIW I am -1, I think this use case doesn't really justify support in core and it can be solved with a custom reporter |
|
This pull request has been marked as stale due to 210 days of inactivity. |
This PR addresses #58937 by introducing support for user-defined color customization in the test runner output.
Users can now configure the theme colors by setting the
NODE_TEST_RUNNER_THEMEenvironment variable with a JSON string.I followed the current implementation style by using the colors already defined in internal/util/colors. While the issue raises a concern about color contrast, I preferred to stick with the existing set of colors to maintain consistency. I simply chose to allow color overrides instead of changing how shouldColorize or the color system itself behaves.
I’d appreciate feedback on whether this was the right approach. Thx
NODE_TEST_RUNNER_THEME='{"fail":"blue","pass":"yellow","info":"red","base":"red","duration":"green","skip":"blue"}