diff options
author | Marvin Hagemeister <marvin@deno.com> | 2024-08-08 13:52:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-08 13:52:14 +0200 |
commit | f50d38869d004fdcfbbdd165f634ab4a4a612d1f (patch) | |
tree | c38c884d2763e4f17c681723b7ee830c4379a6f7 | |
parent | 65224786d2661fc9d1c42fba17d66079600db6ad (diff) |
fix(node/util): add missing `debug` alias of `debuglog` (#24944)
Add the missing `node:util.debug` export which is an alias of
`node:util.debuglog`, see
https://nodejs.org/api/util.html#utildebugsection
-rw-r--r-- | ext/node/polyfills/util.ts | 2 | ||||
-rw-r--r-- | tests/unit_node/util_test.ts | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/ext/node/polyfills/util.ts b/ext/node/polyfills/util.ts index 0c150301a..eee171ccf 100644 --- a/ext/node/polyfills/util.ts +++ b/ext/node/polyfills/util.ts @@ -47,6 +47,7 @@ import { parseArgs } from "ext:deno_node/internal/util/parse_args/parse_args.js" export { callbackify, debuglog, + debuglog as debug, format, formatWithOptions, inspect, @@ -321,5 +322,6 @@ export default { toUSVString, log, debuglog, + debug: debuglog, isDeepStrictEqual, }; diff --git a/tests/unit_node/util_test.ts b/tests/unit_node/util_test.ts index f245a647a..2b639538c 100644 --- a/tests/unit_node/util_test.ts +++ b/tests/unit_node/util_test.ts @@ -8,6 +8,7 @@ import { } from "@std/assert"; import { stripAnsiCode } from "@std/fmt/colors"; import * as util from "node:util"; +import utilDefault from "node:util"; import { Buffer } from "node:buffer"; Deno.test({ @@ -322,3 +323,10 @@ Deno.test({ util.parseArgs({}); }, }); + +Deno.test("[util] debuglog() and debug()", () => { + assert(typeof util.debug === "function"); + assert(typeof util.debuglog === "function"); + assertEquals(util.debuglog, util.debug); + assertEquals(utilDefault.debuglog, utilDefault.debug); +}); |