summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-08-21 15:23:32 -0700
committerGitHub <noreply@github.com>2024-08-21 15:23:32 -0700
commit48da3c17ea905f50b82948e6f94795e1589f852e (patch)
treee65d5da97ef0cd4b9f67972b8ba647420d39952e /tests
parent9aaad3064a412b24e88e308750e038d4e1df6f3c (diff)
fix(add): Handle packages without root exports (#25102)
Fixes #24607. This PR makes the logic that caches top level dependencies (things present in import map) smarter, so we handle JSR dependencies without root exports.
Diffstat (limited to 'tests')
-rw-r--r--tests/registry/jsr/@std/testing/1.0.0/bdd.ts2
-rw-r--r--tests/registry/jsr/@std/testing/1.0.0/types.ts1
-rw-r--r--tests/registry/jsr/@std/testing/1.0.0_meta.json6
-rw-r--r--tests/registry/jsr/@std/testing/meta.json8
-rw-r--r--tests/specs/add/no_root_export/__test__.jsonc9
-rw-r--r--tests/specs/add/no_root_export/add.out5
-rw-r--r--tests/specs/add/no_root_export/deno.json0
-rw-r--r--tests/specs/add/no_root_export/main.ts3
-rw-r--r--tests/specs/install/future_install_local_deno/deno.json4
-rw-r--r--tests/specs/install/future_install_local_deno/deno.lock.out12
-rw-r--r--tests/specs/install/future_install_local_deno/install.out4
-rw-r--r--tests/specs/remove/basic/add.out6
12 files changed, 55 insertions, 5 deletions
diff --git a/tests/registry/jsr/@std/testing/1.0.0/bdd.ts b/tests/registry/jsr/@std/testing/1.0.0/bdd.ts
new file mode 100644
index 000000000..a665d0603
--- /dev/null
+++ b/tests/registry/jsr/@std/testing/1.0.0/bdd.ts
@@ -0,0 +1,2 @@
+export function it(_name: string, _fn: () => void) {
+} \ No newline at end of file
diff --git a/tests/registry/jsr/@std/testing/1.0.0/types.ts b/tests/registry/jsr/@std/testing/1.0.0/types.ts
new file mode 100644
index 000000000..feebd2603
--- /dev/null
+++ b/tests/registry/jsr/@std/testing/1.0.0/types.ts
@@ -0,0 +1 @@
+export type AssertType<A, B> = A extends B ? true : never; \ No newline at end of file
diff --git a/tests/registry/jsr/@std/testing/1.0.0_meta.json b/tests/registry/jsr/@std/testing/1.0.0_meta.json
new file mode 100644
index 000000000..5c1bdd807
--- /dev/null
+++ b/tests/registry/jsr/@std/testing/1.0.0_meta.json
@@ -0,0 +1,6 @@
+{
+ "exports": {
+ "./bdd": "./bdd.ts",
+ "./types": "./types.ts"
+ }
+} \ No newline at end of file
diff --git a/tests/registry/jsr/@std/testing/meta.json b/tests/registry/jsr/@std/testing/meta.json
new file mode 100644
index 000000000..d8037eabb
--- /dev/null
+++ b/tests/registry/jsr/@std/testing/meta.json
@@ -0,0 +1,8 @@
+{
+ "scope": "std",
+ "name": "path",
+ "latest": "1.0.0",
+ "versions": {
+ "1.0.0": {}
+ }
+}
diff --git a/tests/specs/add/no_root_export/__test__.jsonc b/tests/specs/add/no_root_export/__test__.jsonc
new file mode 100644
index 000000000..2adfbd8de
--- /dev/null
+++ b/tests/specs/add/no_root_export/__test__.jsonc
@@ -0,0 +1,9 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "add @std/testing",
+ "output": "add.out"
+ }
+ ]
+}
diff --git a/tests/specs/add/no_root_export/add.out b/tests/specs/add/no_root_export/add.out
new file mode 100644
index 000000000..4bd9da7be
--- /dev/null
+++ b/tests/specs/add/no_root_export/add.out
@@ -0,0 +1,5 @@
+Add jsr:@std/testing@1.0.0
+[UNORDERED_START]
+Download http://127.0.0.1:4250/@std/testing/1.0.0/bdd.ts
+Download http://127.0.0.1:4250/@std/testing/1.0.0/types.ts
+[UNORDERED_END]
diff --git a/tests/specs/add/no_root_export/deno.json b/tests/specs/add/no_root_export/deno.json
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/specs/add/no_root_export/deno.json
diff --git a/tests/specs/add/no_root_export/main.ts b/tests/specs/add/no_root_export/main.ts
new file mode 100644
index 000000000..0c0d4107f
--- /dev/null
+++ b/tests/specs/add/no_root_export/main.ts
@@ -0,0 +1,3 @@
+import { it } from "@std/testing/bdd";
+
+const _it = it;
diff --git a/tests/specs/install/future_install_local_deno/deno.json b/tests/specs/install/future_install_local_deno/deno.json
index dbcf1c220..9213ce834 100644
--- a/tests/specs/install/future_install_local_deno/deno.json
+++ b/tests/specs/install/future_install_local_deno/deno.json
@@ -3,6 +3,8 @@
"@std/fs/": "https://deno.land/std@0.224.0/fs/",
"@denotest/esm-basic": "npm:@denotest/esm-basic@^1.0.0",
"@denotest/add": "jsr:@denotest/add",
- "test-http": "http://localhost:4545/v1/extensionless"
+ "test-http": "http://localhost:4545/v1/extensionless",
+ "@std/testing": "jsr:@std/testing",
+ "@std/testing/": "jsr:/@std/testing/"
}
}
diff --git a/tests/specs/install/future_install_local_deno/deno.lock.out b/tests/specs/install/future_install_local_deno/deno.lock.out
index 188de5de9..04bfc9b3a 100644
--- a/tests/specs/install/future_install_local_deno/deno.lock.out
+++ b/tests/specs/install/future_install_local_deno/deno.lock.out
@@ -2,11 +2,15 @@
"version": "4",
"specifiers": {
"jsr:@denotest/add": "jsr:@denotest/add@1.0.0",
+ "jsr:@std/testing": "jsr:@std/testing@1.0.0",
"npm:@denotest/esm-basic@^1.0.0": "npm:@denotest/esm-basic@1.0.0"
},
"jsr": {
"@denotest/add@1.0.0": {
"integrity": "[WILDCARD]"
+ },
+ "@std/testing@1.0.0": {
+ "integrity": "[WILDCARD]"
}
},
"npm": {
@@ -14,10 +18,16 @@
"integrity": "[WILDCARD]"
}
},
- "remote": [WILDCARD],
+ "remote": {
+ "http://localhost:4545/subdir/mod1.ts": "[WILDCARD]",
+ "http://localhost:4545/subdir/print_hello.ts": "[WILDCARD]",
+ "http://localhost:4545/subdir/subdir2/mod2.ts": "[WILDCARD]",
+ "http://localhost:4545/v1/extensionless": "[WILDCARD]"
+ },
"workspace": {
"dependencies": [
"jsr:@denotest/add",
+ "jsr:@std/testing",
"npm:@denotest/esm-basic@^1.0.0"
]
}
diff --git a/tests/specs/install/future_install_local_deno/install.out b/tests/specs/install/future_install_local_deno/install.out
index eecba1299..15263a37b 100644
--- a/tests/specs/install/future_install_local_deno/install.out
+++ b/tests/specs/install/future_install_local_deno/install.out
@@ -1,4 +1,6 @@
[UNORDERED_START]
+Download http://127.0.0.1:4250/@std/testing/meta.json
+Download http://127.0.0.1:4250/@std/testing/1.0.0_meta.json
Download http://localhost:4545/v1/extensionless
Download http://localhost:4545/subdir/mod1.ts
Download http://localhost:4545/subdir/subdir2/mod2.ts
@@ -8,4 +10,6 @@ Download http://127.0.0.1:4250/@denotest/add/1.0.0_meta.json
Download http://127.0.0.1:4250/@denotest/add/1.0.0/mod.ts
Download http://localhost:4260/@denotest/esm-basic
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Download http://127.0.0.1:4250/@std/testing/1.0.0/bdd.ts
+Download http://127.0.0.1:4250/@std/testing/1.0.0/types.ts
[UNORDERED_END]
diff --git a/tests/specs/remove/basic/add.out b/tests/specs/remove/basic/add.out
index a93b0ab52..75848b7c6 100644
--- a/tests/specs/remove/basic/add.out
+++ b/tests/specs/remove/basic/add.out
@@ -1,9 +1,9 @@
Created deno.json configuration file.
-Add jsr:@std/assert@1.0.0
+[UNORDERED_START]
Add jsr:@std/http@1.0.0
+Add jsr:@std/assert@1.0.0
+[UNORDERED_END]
[UNORDERED_START]
-Download http://127.0.0.1:4250/@std/http/1.0.0_meta.json
-Download http://127.0.0.1:4250/@std/assert/1.0.0_meta.json
Download http://127.0.0.1:4250/@std/http/1.0.0/mod.ts
Download http://127.0.0.1:4250/@std/assert/1.0.0/mod.ts
Download http://127.0.0.1:4250/@std/assert/1.0.0/assert_equals.ts