Skip to content

Commit

Permalink
fix(node/util): export styleText from node:util (#26194)
Browse files Browse the repository at this point in the history
Fixes #26184.

It was added but not publicly exported.
  • Loading branch information
nathanwhit authored Oct 12, 2024
1 parent 7a990d9 commit 4f89225
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/node/polyfills/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -63,6 +64,7 @@ export {
parseArgs,
promisify,
stripVTControlCharacters,
styleText,
types,
};

Expand Down Expand Up @@ -354,4 +356,5 @@ export default {
debuglog,
debug: debuglog,
isDeepStrictEqual,
styleText,
};
5 changes: 5 additions & 0 deletions tests/unit_node/util_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

0 comments on commit 4f89225

Please sign in to comment.