diff options
Diffstat (limited to 'cli/tests/unit_node/module_test.ts')
-rw-r--r-- | cli/tests/unit_node/module_test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/tests/unit_node/module_test.ts b/cli/tests/unit_node/module_test.ts new file mode 100644 index 000000000..d071ed2d1 --- /dev/null +++ b/cli/tests/unit_node/module_test.ts @@ -0,0 +1,14 @@ +// 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"; + +Deno.test("[node/module _preloadModules] has internal require hook", () => { + // Check if it's there + // deno-lint-ignore no-explicit-any + (Module as any)._preloadModules([ + "./cli/tests/unit_node/testdata/add_global_property.js", + ]); + // deno-lint-ignore no-explicit-any + assertStrictEquals((globalThis as any).foo, "Hello"); +}); |