-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
assert: add env to show the full error #22119
Conversation
This adds the `NODE_ASSERT_FULL` environment variable to give the user the option to opt into seeing the full error message even though the diff is at least partially identical. Fixes: nodejs#19106
doc/api/assert.md
Outdated
Using that environment variable will also deactivate the colors in the REPL. | ||
|
||
The diff will also be minified in case more than three lines are identical or if | ||
either side of an loose equal check is longer than 128 characters. To prevent |
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.
Nit: an loose -> a loose.
It seems these 3 files should also be updated? https://github.com/nodejs/node/blob/master/doc/api/cli.md#environment-variables Line 274 in 0518b9e
Line 2580 in 0518b9e
|
Comments addressed. PTAL. |
Docs LGTM. |
hmm... not really a fan of introducing new environment variables at this point. Why would this not be an API option? |
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.
LGTM
@jasnell assert has no options so far. I thought about three different implementations: a) using the environment variable. b) Refactoring assert in a backwards compatible way to a class and allowing defaults. c) adding options to the function calls. a) is the most straight forward I am against c) because I would like to go into a different direction there. I could rewrite it to b) if you would rather have that. In that case the assert as is currently exist would just be a instance of the class. |
I'd almost prefer option B. Yes, it's more work, but environment variables are not really a great approach, even if simple. |
Can't really review the code as I am not really familiar with assert.js now, but I don't mind the environment variable as options in |
@BridgeAR I’m not sure if I understand option b) correctly, but if it’s something like |
@addaleax yes, you understood correct :-) I am planning to open a new PR with that change soon and to close this one at that point. |
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.
Red X'ing this just to make sure no one lands it. My understanding is that a new PR will be opened that introduces an option rather than using an environment variable like this PR does.
Closing for now. I'll open a new PR when I get to it. |
This adds the
NODE_ASSERT_FULL
environment variable to give theuser the option to opt into seeing the full error message even though
the diff is at least partially identical.
Fixes: #19106
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes