diff options
Diffstat (limited to 'tests')
9 files changed, 79 insertions, 0 deletions
diff --git a/tests/registry/npm/@denotest/bin/0.7.0/cli-no-ext b/tests/registry/npm/@denotest/bin/0.7.0/cli-no-ext new file mode 100644 index 000000000..1cad127ca --- /dev/null +++ b/tests/registry/npm/@denotest/bin/0.7.0/cli-no-ext @@ -0,0 +1,3 @@ +#!/usr/bin/env -S node + +console.log("@denotest/bin 0.7.0"); diff --git a/tests/registry/npm/@denotest/bin/0.7.0/cli.mjs b/tests/registry/npm/@denotest/bin/0.7.0/cli.mjs new file mode 100644 index 000000000..1cad127ca --- /dev/null +++ b/tests/registry/npm/@denotest/bin/0.7.0/cli.mjs @@ -0,0 +1,3 @@ +#!/usr/bin/env -S node + +console.log("@denotest/bin 0.7.0"); diff --git a/tests/registry/npm/@denotest/bin/0.7.0/package.json b/tests/registry/npm/@denotest/bin/0.7.0/package.json new file mode 100644 index 000000000..d66b6e34d --- /dev/null +++ b/tests/registry/npm/@denotest/bin/0.7.0/package.json @@ -0,0 +1,8 @@ +{ + "name": "@denotest/bin", + "version": "0.7.0", + "bin": { + "cli-esm": "./cli.mjs", + "cli-no-ext": "./cli-no-ext" + } +} diff --git a/tests/registry/npm/@denotest/transitive-bin/1.0.0/cli-cjs.js b/tests/registry/npm/@denotest/transitive-bin/1.0.0/cli-cjs.js new file mode 100644 index 000000000..f517654b9 --- /dev/null +++ b/tests/registry/npm/@denotest/transitive-bin/1.0.0/cli-cjs.js @@ -0,0 +1 @@ +console.log("@denotest/transitive-bin 1.0.0"); diff --git a/tests/registry/npm/@denotest/transitive-bin/1.0.0/package.json b/tests/registry/npm/@denotest/transitive-bin/1.0.0/package.json new file mode 100644 index 000000000..84d780516 --- /dev/null +++ b/tests/registry/npm/@denotest/transitive-bin/1.0.0/package.json @@ -0,0 +1,10 @@ +{ + "name": "@denotest/transitive-bin", + "version": "1.0.0", + "dependencies": { + "@denotest/bin": "1.0.0" + }, + "bin": { + "cli-cjs": "cli-cjs.js" + } +}
\ No newline at end of file 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" + } +} |