summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/module_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit_node/module_test.ts')
-rw-r--r--cli/tests/unit_node/module_test.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/cli/tests/unit_node/module_test.ts b/cli/tests/unit_node/module_test.ts
index d071ed2d1..a5c819d96 100644
--- a/cli/tests/unit_node/module_test.ts
+++ b/cli/tests/unit_node/module_test.ts
@@ -1,7 +1,8 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { Module } from "node:module";
-import { assertStrictEquals } from "../../../test_util/std/testing/asserts.ts";
+import { assertEquals } from "../../../test_util/std/testing/asserts.ts";
+import process from "node:process";
Deno.test("[node/module _preloadModules] has internal require hook", () => {
// Check if it's there
@@ -10,5 +11,17 @@ Deno.test("[node/module _preloadModules] has internal require hook", () => {
"./cli/tests/unit_node/testdata/add_global_property.js",
]);
// deno-lint-ignore no-explicit-any
- assertStrictEquals((globalThis as any).foo, "Hello");
+ assertEquals((globalThis as any).foo, "Hello");
+});
+
+Deno.test("[node/module runMain] loads module using the current process.argv", () => {
+ process.argv = [
+ process.argv[0],
+ "./cli/tests/unit_node/testdata/add_global_property_run_main.js",
+ ];
+
+ // deno-lint-ignore no-explicit-any
+ (Module as any).runMain();
+ // deno-lint-ignore no-explicit-any
+ assertEquals((globalThis as any).calledViaRunMain, true);
});