Uh oh!
There was an error while loading. Please reload this page.
test: improve logged errors - #31425
Conversation
To indicate which lines are test lines and which from Node.js core, it's good to rely on `util.inspect()` while inspecting errors. The stack was accessed directly instead in multiple cases and logging that does not provide as much information as using `util.inspect()`.
nodejs-github-bot
commented
Jan 20, 2020
BridgeAR
commented
Jan 22, 2020
@nodejs/testing @nodejs/util PTAL. This improves the terminal output for multiple error cases in our tests. |
Trott
commented
Jan 23, 2020
LGTM. Might be a good idea to post something in a comment here showing the before/after difference. Might be useful for both current reviewers and people doing git-archaeology at a later date. |
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Jan 25, 2020
nodejs-github-bot
commented
Jan 26, 2020
| throw new Error(`same id added to destroy list twice (${id})`); | ||
| } | ||
| destroyListList[id] = new Error().stack; | ||
| destroyListList[id] = util.inspect(new Error()); |
There was a problem hiding this comment.
What's an example of a situation where this will result in a better stack?
There was a problem hiding this comment.
Node.js core frames are visualized in grey. It makes it easier to distinguish the test code from core code.
To indicate which lines are test lines and which from Node.js core, it's good to rely on `util.inspect()` while inspecting errors. The stack was accessed directly instead in multiple cases and logging that does not provide as much information as using `util.inspect()`. PR-URL: #31425 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yihong Wang <yh.wang@ibm.com>
BridgeAR
commented
Feb 9, 2020
Landed in 1450ea7 🎉 |
To indicate which lines are test lines and which from Node.js core, it's good to rely on `util.inspect()` while inspecting errors. The stack was accessed directly instead in multiple cases and logging that does not provide as much information as using `util.inspect()`. PR-URL: #31425 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yihong Wang <yh.wang@ibm.com>
@BridgeAR if this is something that should be in |
To indicate which lines are test lines and which from Node.js core, it's good to rely on `util.inspect()` while inspecting errors. The stack was accessed directly instead in multiple cases and logging that does not provide as much information as using `util.inspect()`. PR-URL: nodejs#31425 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yihong Wang <yh.wang@ibm.com>
To indicate which lines are test lines and which from Node.js core, it's good to rely on `util.inspect()` while inspecting errors. The stack was accessed directly instead in multiple cases and logging that does not provide as much information as using `util.inspect()`. PR-URL: #31425 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yihong Wang <yh.wang@ibm.com>
To indicate which lines are test lines and which are from Node.js core,
it's good to rely upon
util.inspect()while inspecting errors. Using it also logs error properties and provides more informations about the error.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes