summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/module_test.ts
blob: d071ed2d18752486d8abfe31bb0bf194a062e77b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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");
});