-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using `util.inspect` on errors is going to highlight userland and node_module stack frames from now on. This is done by marking Node.js core frames grey and frames that contain `node_modules` in their path yellow. That way it's easy to grasp what frames belong to what code. PR-URL: #27052 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
Showing
6 changed files
with
133 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
'use strict'; | ||
require('../common'); | ||
const vm = require('vm'); | ||
// Make this test OS-independent by overriding stdio getColorDepth(). | ||
process.stdout.getColorDepth = () => 8; | ||
process.stderr.getColorDepth = () => 8; | ||
|
||
console.log({ foo: 'bar' }); | ||
console.log('%s q', 'string'); | ||
console.log('%o with object format param', { foo: 'bar' }); | ||
|
||
console.log( | ||
new Error('test\n at abc (../fixtures/node_modules/bar.js:4:4)\nfoobar') | ||
); | ||
|
||
try { | ||
require('../fixtures/node_modules/node_modules/bar.js'); | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
|
||
vm.runInThisContext('console.log(new Error())'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,38 @@ | ||
{ foo: *[32m'bar'*[39m } | ||
string q | ||
{ foo: *[32m'bar'*[39m } with object format param | ||
|
||
Error: test | ||
at abc (../fixtures/node_modules/bar.js:4:4) | ||
foobar | ||
at * (*console_colors.js:*:*) | ||
*[90m at * (internal*:*:*)*[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
|
||
Error: Should not ever get here. | ||
at * (*node_modules*[4m*node_modules*[24m*bar.js:*:*) | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
at * (*console_colors.js:*:*) | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
|
||
Error | ||
at evalmachine.<anonymous>:*:* | ||
*[90m at Script.runInThisContext (vm.js:*:*)*[39m | ||
*[90m at Object.runInThisContext (vm.js:*:*)*[39m | ||
at * (*console_colors.js:*:*) | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m | ||
*[90m at *[39m |