You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This changes the util.inspect() output for errors in case stack
traces contain the current working directory in their trace.
If that's the case, the cwd part is marked grey to focus on the
rest of the path.
Signed-off-by: Ruben Bridgewater <[email protected]>
PR-URL: #41082
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
// Use a fake stack to verify the expected colored outcome.
2872
+
err.stack='Error: ESM and CJS mixed are both grayed out!\n'+
2873
+
` at ${encodedCwd}/test/parallel/test-esm.mjs:2760:12\n`+
2874
+
` at Object.<anonymous> (${encodedCwd}/node_modules/esm_module/folder/file.js:2753:10)\n`+
2875
+
` at ${process.cwd()}${sl}test${sl}parallel${sl}test-cjs.js:2760:12\n`+
2876
+
` at Object.<anonymous> (${process.cwd()}${sl}node_modules${sl}cjs_module${sl}folder${sl}file.js:2753:10)`;
2877
+
2878
+
letactual=util.inspect(err,{colors: true});
2879
+
letexpected='Error: ESM and CJS mixed are both grayed out!\n'+
2880
+
` at \x1B[90m${encodedCwd}/\x1B[39mtest/parallel/test-esm.mjs:2760:12\n`+
2881
+
` at Object.<anonymous> \x1B[90m(${encodedCwd}/\x1B[39mnode_modules/\x1B[4mesm_module\x1B[24m/folder/file.js:2753:10\x1B[90m)\x1B[39m\n`+
2882
+
` at \x1B[90m${process.cwd()}${sl}\x1B[39mtest${sl}parallel${sl}test-cjs.js:2760:12\n`+
2883
+
` at Object.<anonymous> \x1B[90m(${process.cwd()}${sl}\x1B[39mnode_modules${sl}\x1B[4mcjs_module\x1B[24m${sl}folder${sl}file.js:2753:10\x1B[90m)\x1B[39m`;
0 commit comments