summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/module_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-07-02 20:19:30 +0200
committerGitHub <noreply@github.com>2023-07-02 20:19:30 +0200
commit01f0d03ae82c422c1f9551f3bfbb57daac769ddc (patch)
tree4506903def90de3da497c81e217d70d62f380dab /cli/tests/unit_node/module_test.ts
parent805497a9a50c3219f64f481feb72271b2fcd6790 (diff)
refactor: rename built-in node modules from ext:deno_node/ to node: (#19680)
Closes https://github.com/denoland/deno/issues/19510
Diffstat (limited to 'cli/tests/unit_node/module_test.ts')
-rw-r--r--cli/tests/unit_node/module_test.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/cli/tests/unit_node/module_test.ts b/cli/tests/unit_node/module_test.ts
index 3a675c7a1..9818f4766 100644
--- a/cli/tests/unit_node/module_test.ts
+++ b/cli/tests/unit_node/module_test.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-import { Module } from "node:module";
+import { createRequire, Module } from "node:module";
import {
assert,
assertEquals,
@@ -58,3 +58,18 @@ Deno.test("[node/module _nodeModulePaths] prevents duplicate root /node_modules"
"Missing root 'node_modules' directory",
);
});
+
+Deno.test("Built-in Node modules have `node:` prefix", () => {
+ let thrown = false;
+ try {
+ // @ts-ignore We want to explicitly test wrong call signature
+ createRequire();
+ } catch (e) {
+ thrown = true;
+ const stackLines = e.stack.split("\n");
+ // Assert that built-in node modules have `node:<mod_name>` specifiers.
+ assert(stackLines.some((line: string) => line.includes("(node:module:")));
+ }
+
+ assert(thrown);
+});