From 3c7057d5832bae61de7f5001df85d2505d6aa9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Hern=C3=A1ndez?= <73640929+javihernant@users.noreply.github.com> Date: Sun, 18 Feb 2024 15:30:27 +0100 Subject: [PATCH] fix: util.parseArgs() missing node:process import (#22405) fix parseArgs() not working due to missing import of node:process this commit fixes issue #22363 --- ext/node/polyfills/internal/util/parse_args/parse_args.js | 2 ++ tests/unit_node/util_test.ts | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/ext/node/polyfills/internal/util/parse_args/parse_args.js b/ext/node/polyfills/internal/util/parse_args/parse_args.js index 2c208a897d..8abe8a9f8f 100644 --- a/ext/node/polyfills/internal/util/parse_args/parse_args.js +++ b/ext/node/polyfills/internal/util/parse_args/parse_args.js @@ -46,6 +46,8 @@ const { ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL, } = codes; +import process from "node:process"; + function getMainArgs() { // Work out where to slice process.argv for user supplied arguments. diff --git a/tests/unit_node/util_test.ts b/tests/unit_node/util_test.ts index e01226e3a7..85fa727414 100644 --- a/tests/unit_node/util_test.ts +++ b/tests/unit_node/util_test.ts @@ -315,3 +315,10 @@ Deno.test({ ); }, }); + +Deno.test({ + name: "[util] parseArgs() with no args works", + fn() { + util.parseArgs({}); + }, +});