From bb1ee65cf20b38d1cba7f92bbcc31165365dd758 Mon Sep 17 00:00:00 2001 From: Harshil Patel <26harshilpatel11@gmail.com> Date: Fri, 22 Nov 2024 21:58:23 -0500 Subject: [PATCH] test_runner: add level parameter to reporter.diagnostic Added a parameter to to allow severity-based formatting for diagnostic messages. Defaults to 'info'. This update enables better control over message presentation (e.g., coloring) based on severity levels such as 'info', 'warn', and 'error'. Refs: https://github.com/nodejs/node/issues/55922 --- lib/internal/test_runner/tests_stream.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/test_runner/tests_stream.js b/lib/internal/test_runner/tests_stream.js index ecbc407e01f318..2ae1ce923982ea 100644 --- a/lib/internal/test_runner/tests_stream.js +++ b/lib/internal/test_runner/tests_stream.js @@ -114,11 +114,12 @@ class TestsStream extends Readable { }); } - diagnostic(nesting, loc, message) { + diagnostic(nesting, loc, message, level = 'info') { this[kEmitMessage]('test:diagnostic', { __proto__: null, nesting, message, + level, ...loc, }); }