-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
format: fix issues with colors support #2026
Conversation
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.
Looks good 🙂
Changelog entry is missing
Also, I do not get why do we add a stream to getColorFns
?
Co-authored-by: Aurélien Reeves <aurelien.reeves@smartbear.com>
We pass in the stream that the formatter is outputting to, so that |
Thanks Team, tested and all good! |
🤔 What's changed?
We recently switched from
colors
tochalk
for handling terminal colors.chalk
includes its own rather comprehensive support checks at runtime, which had the unintended effect of disregarding a user-providedcolorsEnabled: true
(fixes #2011).Now, rather than our own support check (which was just
stream.isTTY
), we explicitly delegate to chalk's detection library, for the specific output stream in question, and then construct our own chalk instance with the result (having overrided it based on the format option if necessary). See the feature file and docs for more detail, but the upshot is:colorsEnabled
option now works againFORCE_COLOR
which chalk supports, and we recommend it (for reasons in the docs)🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
🚨 After considering this, I'd like to go a bit further and deprecate (with intent to eventually remove) the
colorsEnabled
format option in favour of having users just use the kinda-standardFORCE_COLOR
environment variable, which can at least influence other tools like assertion libraries which usechalk
directly (see #1551) and would remove some complexity on our side (as we'd just fully delegate the logic tosupports-color
). Mocha folks have also leant intoFORCE_COLOR
to some degree in mochajs/mocha#3641Unless there are some implications I'm not seeing for integrators using Cucumber programmatically - paging @nicojs @jan-molak?
📋 Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.