-
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
test: assert diff no color #24181
test: assert diff no color #24181
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.
Can you add a comment explaining what is being tested? The test passes (in my environment at least) even without the NODE_DISABLE_COLORS
or with that environment variable set to false
. (EDIT: More explanation below about why the test is passing regardless of env variable setting.)
process.env.NODE_DISABLE_COLORS = true; | ||
|
||
try { | ||
assert.strictEqual(1, 3); |
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.
This won't normally result in colorized output, at least not in my environment. assert.deepStrictEqual({a: 'a'}, {})
will do the trick.
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.
This test is not quite correct, I don't think. See comments.
OK, so the To get colorized output, maybe try something like |
Hi @Trott. Thanks for pointing that out. I did a rocky mistake. When I first ran the test it was with a node version installed locally (10.13.0) not with the version from master. That version had colors and a different text on strictEqual. When I found out that I had to run with I will update the pull request and add some description about the test case |
I made the changes. |
Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/18585/ |
Landed in a2c2c78 |
PR-URL: nodejs#24181 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #24181 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#24181 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
This pull request adds a test that covers lines 313-316 from
root/internal assert.js
. Specifically it tests the scenario when the tty does not support colors and the assert messages should not be decorated.I emulated the scenario by setting the environment variable
NODE_DISABLE_COLORS
totrue
make -j4 test
(UNIX), orvcbuild test
(Windows) passes