From fa7eaa16a9d4ac040e674e4119826d8f717af8c4 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Thu, 7 Aug 2025 10:58:19 +0800 Subject: [PATCH 1/3] util: styleText the error message should include the color alias --- lib/internal/util/inspect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 78318243e65eca..52cca059ba3c78 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -480,7 +480,7 @@ function defineColorAlias(target, alias) { this[target] = value; }, configurable: true, - enumerable: false, + enumerable: true, }); } From 3a7b49b7591dcc83c0aef2ad20eefae5b6fe055b Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Thu, 7 Aug 2025 11:16:23 +0800 Subject: [PATCH 2/3] util: test --- test/parallel/test-util-styletext.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-util-styletext.js b/test/parallel/test-util-styletext.js index b87c5d7e82c74c..70578598920eb5 100644 --- a/test/parallel/test-util-styletext.js +++ b/test/parallel/test-util-styletext.js @@ -22,6 +22,7 @@ const noChange = 'test'; util.styleText(invalidOption, 'test'); }, { code: 'ERR_INVALID_ARG_VALUE', + message: /grey/, // gray alias }); assert.throws(() => { util.styleText('red', invalidOption); From ec2207af42b9bf5e726ccf5be2eb0545bfa21967 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Thu, 7 Aug 2025 11:49:35 +0800 Subject: [PATCH 3/3] util: test update --- test/parallel/test-util-inspect.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index b06f6814e4985a..6b2be13a182416 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -2318,11 +2318,11 @@ assert.strictEqual( ); rejection.catch(() => {}); - // Verify that aliases do not show up as key while checking `inspect.colors`. + // Verify that aliases should show up as key while checking `inspect.colors`. const colors = Object.keys(inspect.colors); const aliases = Object.getOwnPropertyNames(inspect.colors) .filter((c) => !colors.includes(c)); - assert(!colors.includes('grey')); + assert(colors.includes('grey')); assert(colors.includes('gray')); // Verify that all aliases are correctly mapped. for (const alias of aliases) {