console: colorize console error and warn · nodejs/node@db76c58 · GitHub
Skip to content

Commit db76c58

Browse files
MrJithiltargos
authored andcommitted
console: colorize console error and warn
prints console error in red and warn in yellow PR-URL: #51629 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Ruy Adorno <ruy@vlt.sh> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent d169d0f commit db76c58

5 files changed

Lines changed: 27 additions & 12 deletions

File tree

lib/internal/console/constructor.js

Lines changed: 20 additions & 5 deletions

test/parallel/test-repl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ const errorTests = [
770770
'Object [console] {',
771771
' log: [Function: log],',
772772
' warn: [Function: warn],',
773+
' error: [Function: error],',
773774
' dir: [Function: dir],',
774775
' time: [Function: time],',
775776
' timeEnd: [Function: timeEnd],',
@@ -785,7 +786,6 @@ const errorTests = [
785786
/ {2}debug: \[Function: (debug|log)],/,
786787
/ {2}info: \[Function: (info|log)],/,
787788
/ {2}dirxml: \[Function: (dirxml|log)],/,
788-
/ {2}error: \[Function: (error|warn)],/,
789789
/ {2}groupCollapsed: \[Function: (groupCollapsed|group)],/,
790790
/ {2}Console: \[Function: Console],?/,
791791
...process.features.inspector ? [
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
(node:*) Warning: The 'NODE_DISABLE_COLORS' env is ignored due to the 'FORCE_COLOR' env being set.
3-
(Use `* --trace-warnings ...` to show where the warning was created)
2+
*(node:*) Warning: The 'NODE_DISABLE_COLORS' env is ignored due to the 'FORCE_COLOR' env being set.
3+
(Use `* --trace-warnings ...` to show where the warning was created)*
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
(node:*) Warning: The 'NODE_DISABLE_COLORS' and 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
3-
(Use `* --trace-warnings ...` to show where the warning was created)
2+
*(node:*) Warning: The 'NODE_DISABLE_COLORS' and 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
3+
(Use `* --trace-warnings ...` to show where the warning was created)*
Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)