errors: only init colors when util is not loaded
PR-URL: https://github.com/nodejs/node/pull/18359 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
3ec79216f9
commit
6ef17303a7
@ -270,12 +270,14 @@ class AssertionError extends Error {
|
||||
if (message != null) {
|
||||
super(message);
|
||||
} else {
|
||||
const util = lazyUtil();
|
||||
if (process.stdout.isTTY && process.stdout.getColorDepth() !== 1) {
|
||||
if (util_ === null &&
|
||||
process.stdout.isTTY &&
|
||||
process.stdout.getColorDepth() !== 1) {
|
||||
green = '\u001b[32m';
|
||||
white = '\u001b[39m';
|
||||
red = '\u001b[31m';
|
||||
}
|
||||
const util = lazyUtil();
|
||||
|
||||
if (actual && actual.stack && actual instanceof Error)
|
||||
actual = `${actual.name}: ${actual.message}`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user