summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/npm/require_resolve_bad_paths_global_cache/__test__.jsonc4
-rw-r--r--tests/specs/npm/require_resolve_bad_paths_global_cache/main.out9
-rw-r--r--tests/specs/npm/require_resolve_bad_paths_global_cache/main.ts8
3 files changed, 21 insertions, 0 deletions
diff --git a/tests/specs/npm/require_resolve_bad_paths_global_cache/__test__.jsonc b/tests/specs/npm/require_resolve_bad_paths_global_cache/__test__.jsonc
new file mode 100644
index 000000000..70840dee2
--- /dev/null
+++ b/tests/specs/npm/require_resolve_bad_paths_global_cache/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "run --allow-read main.ts",
+ "output": "main.out"
+}
diff --git a/tests/specs/npm/require_resolve_bad_paths_global_cache/main.out b/tests/specs/npm/require_resolve_bad_paths_global_cache/main.out
new file mode 100644
index 000000000..563d84ac4
--- /dev/null
+++ b/tests/specs/npm/require_resolve_bad_paths_global_cache/main.out
@@ -0,0 +1,9 @@
+[UNORDERED_START]
+Download http://localhost:4545/npm/registry/@denotest/esm-basic
+Download http://localhost:4545/npm/registry/@denotest/require-resolve
+[UNORDERED_END]
+[UNORDERED_START]
+Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz
+Download http://localhost:4545/npm/registry/@denotest/require-resolve/1.0.0.tgz
+[UNORDERED_END]
+[WILDLINE]@denotest[WILDCHAR]esm-basic[WILDCHAR]1.0.0[WILDCHAR]main.mjs
diff --git a/tests/specs/npm/require_resolve_bad_paths_global_cache/main.ts b/tests/specs/npm/require_resolve_bad_paths_global_cache/main.ts
new file mode 100644
index 000000000..c3b236c8f
--- /dev/null
+++ b/tests/specs/npm/require_resolve_bad_paths_global_cache/main.ts
@@ -0,0 +1,8 @@
+import "npm:@denotest/esm-basic";
+import { resolve } from "npm:@denotest/require-resolve";
+
+console.log(resolve("@denotest/esm-basic", {
+ // when using the global cache, it should fallback to resolving bare
+ // specifiers with the global cache when it can't find it via the paths
+ paths: ["/home"],
+}));