Skip to content
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

[Bug]: Summary is red, implying error, even when no issues (Node 20.15+) #5821

Closed
1 task done
mattbrictson opened this issue Jun 28, 2024 · 2 comments · Fixed by #5826 · 4 remaining pull requests
Closed
1 task done

[Bug]: Summary is red, implying error, even when no issues (Node 20.15+) #5821

mattbrictson opened this issue Jun 28, 2024 · 2 comments · Fixed by #5826 · 4 remaining pull requests

Comments

@mattbrictson
Copy link

mattbrictson commented Jun 28, 2024

Kind of Issue

Runtime - command-line tools

Tool or Library

cspell

Version

8.8.4

Supporting Library

Not sure / None

OS

macOS

OS Version

macOS 14.5 (23F79)

Description

Cspell prints its summary output to stderr, which is expected.

However, it does this using console.error, which is intended to be used for actual errors. Starting in Node 20.15, console.error is colored red on supported terminals to reinforce this purpose.

Thus, even when cspell runs successfully with no issues found, on Node 20.15+ the red output makes it seem like something has gone wrong.

Screenshot 2024-06-27 at 6 21 33 PM

I believe that cspell should emit the summary to stderr, but use a method other than console.error. Perhaps process.stderr directly?

Steps to Reproduce

  1. Confirm you are using Node 20.15 by running node --version.
  2. Run cspell and observe that the summary is red, even when there are no issues found.

Expected Behavior

Summary output should be red only if something has gone wrong (i.e. one or more issues found).

Additional Information

Node PR that introduced colorized console.error: nodejs/node#51629

cspell.json

No response

cspell.config.yaml

No response

Example Repository

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mattbrictson mattbrictson changed the title [Bug]: Summary displays in error, implying error, even when no issues (Node 20.15+) [Bug]: Summary is red, implying error, even when no issues (Node 20.15+) Jun 28, 2024
@Jason3S
Copy link
Collaborator

Jason3S commented Jun 29, 2024

@mattbrictson,

Thank you for letting me know. I'll take a look at it.

That was a strange decision to mess with the output color for all cli applications.

However, it does this using console.error, which is intended to be used for actual errors. Starting in Node 20.15, console.error is colored red on supported terminals to reinforce this purpose.

Since when did the meaning of console.error change to mean it is only for "actual" errors?

I don't see anything in the docs:

Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.