From 4f89225f76ca67e8a6385bbc52a73c284cc3402c Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Sat, 12 Oct 2024 12:36:23 -0700 Subject: [PATCH] fix(node/util): export `styleText` from `node:util` (#26194) Fixes #26184. It was added but not publicly exported. --- ext/node/polyfills/util.ts | 3 +++ tests/unit_node/util_test.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ext/node/polyfills/util.ts b/ext/node/polyfills/util.ts index 586fae17e9..d82b288b03 100644 --- a/ext/node/polyfills/util.ts +++ b/ext/node/polyfills/util.ts @@ -39,6 +39,7 @@ import { formatWithOptions, inspect, stripVTControlCharacters, + styleText, } from "ext:deno_node/internal/util/inspect.mjs"; import { codes } from "ext:deno_node/internal/error_codes.ts"; import types from "node:util/types"; @@ -63,6 +64,7 @@ export { parseArgs, promisify, stripVTControlCharacters, + styleText, types, }; @@ -354,4 +356,5 @@ export default { debuglog, debug: debuglog, isDeepStrictEqual, + styleText, }; diff --git a/tests/unit_node/util_test.ts b/tests/unit_node/util_test.ts index edd5002623..a47c231a18 100644 --- a/tests/unit_node/util_test.ts +++ b/tests/unit_node/util_test.ts @@ -348,3 +348,8 @@ Deno.test("[util] aborted()", async () => { await promise; assertEquals(done, true); }); + +Deno.test("[util] styleText()", () => { + const redText = util.styleText("red", "error"); + assertEquals(redText, "\x1B[31merror\x1B[39m"); +});