GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — assert: add error diffs by BridgeAR · Pull Request #17615 · nodejs/node Conversation
|
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: a errror diff -> an error diff
The sentence seems to be missing some punctuation for clarity. Probably a comma after the second word?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, but maybe it is worth to separate the input with js label (for better highlighting and linting) and the output with diff label.
I cannot find any ```diff insets in .md files in this repo or nodejs.org repo. Are we sure they are rendered to the .html docs properly?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1777777 to
8b75434
Compare
There was an error while loading. Please reload this page.
|
I just updated the code. I also improved the diffing algorithm from the first draft. It will now try to optimize the output rudimentary by removing identical lines from the back first, limits the output lines and some other smaller changes. So PTAL |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
8b75434 to
b1a5d42
Compare
|
Rebased due to conflicts. I actually changed the tests to use the new |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@nodejs/collaborators PTAL. This should be ready but it would be nice to get another LG. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We should probably be testing that unix color codes are supported on the current terminal.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don’t think we can test that but it might make sense to:
process.stderr is a TTY
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
That would indeed be nice... I will see what I can do but I am not sure if we can properly detect that.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
grammar nit: comma after the first that? Or maybe just start with Error messages which involve objects …?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can you name the different error diff modes? It’s really hard to keep track of constants 0, 1 and 2 with distinct meanings, especially in code that spans across files.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don’t think we can test that but it might make sense to:
process.stderr is a TTY
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mcollina @addaleax I added a As this is probably also something that other users might want to rely on, I added it to the util module, even though I am not sure if it is the best place for it. What do you think about that? @jasnell @Trott @vsemozhetbyt @TimothyGu please also take another look. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
[stream][] — Missing bottom reference?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9ece1bf to
820ba9a
Compare
|
Rebased and new CI https://ci.nodejs.org/job/node-test-pull-request/12554/ I also addressed the doc comment. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: nodejs#17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
|
Backport opened in #19230 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
From now on all error messages produced by `assert` in strict mode will produce a error diff. Backport-PR-URL: #19230 PR-URL: #17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Right now it is very difficult to determine if a terminal supports colors or not. This function adds this functionality by detecting environment variables and checking process. Backport-PR-URL: #19230 PR-URL: #17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Backport-PR-URL: #19230 PR-URL: #17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
From now on all error messages produced by `assert` in strict mode will produce a error diff. Backport-PR-URL: #19230 PR-URL: #17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Right now it is very difficult to determine if a terminal supports colors or not. This function adds this functionality by detecting environment variables and checking process. Backport-PR-URL: #19230 PR-URL: #17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Backport-PR-URL: #19230 PR-URL: #17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Notable changes:
* assert:
- From now on all error messages produced by `assert` in strict mode
will produce a error diff. (Ruben Bridgewater)
#17615
- From now on it is possible to use a validation object in throws
instead of the other possibilities. (Ruben Bridgewater)
#17584
* crypto:
- allow passing null as IV unless required (Tobias Nießen)
#18644
* fs:
- support as and as+ flags in stringToFlags() (Sarat Addepalli)
#18801
* tls:
- expose Finished messages in TLSSocket (Anton Salikhmetov)
#19102
* tty:
- Add getColorDepth function to determine if terminal supports colors
(Ruben Bridgewater) #17615
* util:
- add util.inspect compact option (Ruben Bridgewater)
#17576
* **Added new collaborators**
- [watson](https://github.com/watson) Thomas Watson
PR-URL: #19428
Notable changes:
* assert:
- From now on all error messages produced by `assert` in strict mode
will produce a error diff. (Ruben Bridgewater)
#17615
- From now on it is possible to use a validation object in throws
instead of the other possibilities. (Ruben Bridgewater)
#17584
* crypto:
- allow passing null as IV unless required (Tobias Nießen)
#18644
* fs:
- support as and as+ flags in stringToFlags() (Sarat Addepalli)
#18801
* tls:
- expose Finished messages in TLSSocket (Anton Salikhmetov)
#19102
* tty:
- Add getColorDepth function to determine if terminal supports colors
(Ruben Bridgewater) #17615
* util:
- add util.inspect compact option (Ruben Bridgewater)
#17576
* **Added new collaborators**
- [watson](https://github.com/watson) Thomas Watson
PR-URL: #19428
| return COLORS_16; | ||
|
|
||
| return COLORS_2; | ||
| }; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This code is mostly copy-pasted from https://github.com/chalk/supports-color/blob/master/index.js and https://github.com/isaacs/color-support/blob/master/index.js with minor style tweaks. I don't see any attribution.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@BridgeAR can you comment on the above?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hey, I just came home and saw this, so I could not respond any earlier.
When writing on this I got the #17615 (comment) from @mcollina that I should check for the colors. So I googled a lot about checking color support in terminals and I tried to gather as much information as I could (I actually tried hard not to rely on environment variables at all). In the end I got inspired by multiple sources including chalk, color-support, different gists, stackoverflow and more that I do not remember. I did not think of anything bad when adding this function. I do see the similarities though and I am more than happy to give the attributions. I am just not sure how to do this properly right now as there are multiple licenses.
@sindresorhus shall I just move the function in a new file and add both license texts? I am not sure about the other sources though. Or would it be fine to add something like: This functionality got inspired by multiple sources including 'chalk' by @sindresorhus and 'color-support' by @isaacs?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ping @isaacs
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I guess also cc @nodejs/tsc FYI
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@BridgeAR
I think moving the color detection code to an internal lib file and put attributions there would be better than doing it in tty.js. But it still comes down to whether @sindresorhus and @isaacs accept it or not.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
TTY tests should almost never be placed in `/parallel/`. Skipping TTY tests there due to missing tty fds just means they will never be run, ever, on any system. This moves the tty-get-color-depth test to `/pseudo-tty/` where the test runner will actually make a pty fd. Refs: nodejs#17615 PR-URL: nodejs#18800 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
From now on all error messages produced by `assert` in strict mode will produce a error diff. PR-URL: nodejs#17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Instead of having three times the same RegExp, just use a helper. PR-URL: nodejs#17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Right now it is very difficult to determine if a terminal supports colors or not. This function adds this functionality by detecting environment variables and checking process. PR-URL: nodejs#17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: nodejs#17615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
TTY tests should almost never be placed in `/parallel/`. Skipping TTY tests there due to missing tty fds just means they will never be run, ever, on any system. This moves the tty-get-color-depth test to `/pseudo-tty/` where the test runner will actually make a pty fd. Refs: nodejs#17615 PR-URL: nodejs#18800 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
|
Requested backport to 8.x in #19230 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.