diff --git a/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/index.js b/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/index.js new file mode 100644 index 00000000000000..f053ebf7976e37 --- /dev/null +++ b/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/index.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/package.json b/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/package.json new file mode 100644 index 00000000000000..79e0f0e1defdf3 --- /dev/null +++ b/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/package.json @@ -0,0 +1,5 @@ +{ + "name": "@denotest/cjs-non-explicit-file", + "version": "1.0.0", + "main": "index.js" +} \ No newline at end of file diff --git a/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/server.js b/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/server.js new file mode 100644 index 00000000000000..ef4ef1ef23580c --- /dev/null +++ b/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/server.js @@ -0,0 +1 @@ +module.exports = require("./server.node"); diff --git a/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/server.node.js b/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/server.node.js new file mode 100644 index 00000000000000..6e9f28dfbf2ef5 --- /dev/null +++ b/tests/registry/npm/@denotest/cjs-non-explicit-file/1.0.0/server.node.js @@ -0,0 +1,3 @@ +module.exports["server"] = function () { + return 1; +}; diff --git a/tests/specs/npm/sub_paths_cjs_import_faillure/__test__.jsonc b/tests/specs/npm/sub_paths_cjs_import_faillure/__test__.jsonc new file mode 100644 index 00000000000000..68de201ff8e166 --- /dev/null +++ b/tests/specs/npm/sub_paths_cjs_import_faillure/__test__.jsonc @@ -0,0 +1,15 @@ +{ + "steps": [{ + "args": "run --quiet sub_paths_cjs_import_faillure/main1.js", + "output": "sub_paths_cjs_import_faillure/main1.out", + "exitCode": 1 + }, { + "args": "run --quiet sub_paths_cjs_import_faillure/main2.js", + "output": "sub_paths_cjs_import_faillure/main2.out", + "exitCode": 1 + }, { + "args": "run --quiet sub_paths_cjs_import_faillure/main3.js", + "output": "sub_paths_cjs_import_faillure/main3.out", + "exitCode": 1 + }] +} diff --git a/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main1.js b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main1.js new file mode 100644 index 00000000000000..4313cc1551b127 --- /dev/null +++ b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main1.js @@ -0,0 +1,2 @@ +import Server from "npm:@denotest/cjs-non-explicit-file@1.0.0/server"; +console.log(Server); diff --git a/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main1.out b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main1.out new file mode 100644 index 00000000000000..a370ab322a3975 --- /dev/null +++ b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main1.out @@ -0,0 +1,5 @@ +error: Unable to load [WILDCARD]server imported from [WILDCARD]main1.js +Did you mean to import "npm:@denotest/cjs-non-explicit-file@1.0.0/server.js"? + +Caused by: +[WILDCARD] diff --git a/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main2.js b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main2.js new file mode 100644 index 00000000000000..e3b361d7f55c9b --- /dev/null +++ b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main2.js @@ -0,0 +1,2 @@ +import Server from "npm:@denotest/cjs-non-explicit-file@1.0.0/server.node"; +console.log(Server); diff --git a/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main2.out b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main2.out new file mode 100644 index 00000000000000..a2d026488e2b16 --- /dev/null +++ b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main2.out @@ -0,0 +1,5 @@ +error: Unable to load [WILDCARD]server.node imported from [WILDCARD]main2.js +Did you mean to import "npm:@denotest/cjs-non-explicit-file@1.0.0/server.node.js"? + +Caused by: +[WILDCARD] diff --git a/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main3.js b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main3.js new file mode 100644 index 00000000000000..a8c17fd810ed23 --- /dev/null +++ b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main3.js @@ -0,0 +1,3 @@ +// deno-fmt-ignore +const Server = await import("npm:@denotest/cjs-non-explicit-file@1.0.0/server"); +console.log(Server); diff --git a/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main3.out b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main3.out new file mode 100644 index 00000000000000..e9d099a8a63505 --- /dev/null +++ b/tests/specs/npm/sub_paths_cjs_import_faillure/sub_paths_cjs_import_faillure/main3.out @@ -0,0 +1,7 @@ +error: Uncaught (in promise) TypeError: Unable to load [WILDCARD]server imported from [WILDCARD]main3.js +Did you mean to import "npm:@denotest/cjs-non-explicit-file@1.0.0/server.js"? + Caused by: +[WILDCARD] +const Server = await import("npm:@denotest/cjs-non-explicit-file@1.0.0/server"); + ^ + at async [WILDCARD]main3.js:[WILDCARD]