summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/npm/bin_entries_prefer_closer/__test__.jsonc26
-rw-r--r--tests/specs/npm/bin_entries_prefer_closer/deno.json3
-rw-r--r--tests/specs/npm/bin_entries_prefer_closer/install.out11
-rw-r--r--tests/specs/npm/bin_entries_prefer_closer/package.json14
4 files changed, 54 insertions, 0 deletions
diff --git a/tests/specs/npm/bin_entries_prefer_closer/__test__.jsonc b/tests/specs/npm/bin_entries_prefer_closer/__test__.jsonc
new file mode 100644
index 000000000..90d788518
--- /dev/null
+++ b/tests/specs/npm/bin_entries_prefer_closer/__test__.jsonc
@@ -0,0 +1,26 @@
+{
+ "envs": {
+ "DENO_FUTURE": "1"
+ },
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install",
+ "output": "install.out"
+ },
+ {
+ "args": "task run-esm",
+ "output": "Task run-esm cli-esm hello world\n@denotest/bin 0.7.0\n"
+ },
+ {
+ "args": "task run-cjs",
+ // @denotest/bin 0.7.0 doesn't have a cli-cjs, so it should use the one from @denotest/transitive-bin
+ // because it's closer than the one from @denotest/bin 1.0.0
+ "output": "Task run-cjs cli-cjs hello world\n@denotest/transitive-bin 1.0.0\n"
+ },
+ {
+ "args": "task run-no-ext",
+ "output": "Task run-no-ext cli-no-ext hello world\n@denotest/bin 0.7.0\n"
+ }
+ ]
+}
diff --git a/tests/specs/npm/bin_entries_prefer_closer/deno.json b/tests/specs/npm/bin_entries_prefer_closer/deno.json
new file mode 100644
index 000000000..176354f98
--- /dev/null
+++ b/tests/specs/npm/bin_entries_prefer_closer/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": true
+}
diff --git a/tests/specs/npm/bin_entries_prefer_closer/install.out b/tests/specs/npm/bin_entries_prefer_closer/install.out
new file mode 100644
index 000000000..25e06db99
--- /dev/null
+++ b/tests/specs/npm/bin_entries_prefer_closer/install.out
@@ -0,0 +1,11 @@
+⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag.
+[UNORDERED_START]
+Download http://localhost:4260/@denotest/transitive-bin
+Download http://localhost:4260/@denotest/bin
+Download http://localhost:4260/@denotest/bin/1.0.0.tgz
+Download http://localhost:4260/@denotest/transitive-bin/1.0.0.tgz
+Download http://localhost:4260/@denotest/bin/0.7.0.tgz
+Initialize @denotest/transitive-bin@1.0.0
+Initialize @denotest/bin@1.0.0
+Initialize @denotest/bin@0.7.0
+[UNORDERED_END]
diff --git a/tests/specs/npm/bin_entries_prefer_closer/package.json b/tests/specs/npm/bin_entries_prefer_closer/package.json
new file mode 100644
index 000000000..af75632ce
--- /dev/null
+++ b/tests/specs/npm/bin_entries_prefer_closer/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "bin_entries_prefer_closer",
+ "dependencies": {
+ "@denotest/bin": "0.7.0",
+ "@denotest/transitive-bin": "1.0.0"
+ },
+
+ "scripts": {
+ "run-esm": "cli-esm hello world",
+ "run-cjs": "cli-cjs hello world",
+ "run-no-ext": "cli-no-ext hello world",
+ "run-ts": "cli-ts"
+ }
+}