diff options
Diffstat (limited to 'cli/tests')
6 files changed, 48 insertions, 0 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs index a16dd5354..ddb815a15 100644 --- a/cli/tests/integration/npm_tests.rs +++ b/cli/tests/integration/npm_tests.rs @@ -775,6 +775,20 @@ itest!(deno_run_bin_esm { http_server: true, }); +itest!(deno_run_bin_esm_no_bin_entrypoint { + args: "run -A --quiet npm:@denotest/bin@0.6.0/cli.mjs this is a test", + output: "npm/deno_run_esm.out", + envs: env_vars_for_npm_tests(), + http_server: true, +}); + +itest!(deno_run_bin_cjs_no_bin_entrypoint { + args: "run -A --quiet npm:@denotest/bin@0.6.0/cli-cjs.js this is a test", + output: "npm/deno_run_cjs.out", + envs: env_vars_for_npm_tests(), + http_server: true, +}); + itest!(deno_run_bin_special_chars { args: "run -A --quiet npm:@denotest/special-chars-in-bin-name/\\foo\" this is a test", output: "npm/deno_run_special_chars_in_bin_name.out", @@ -817,6 +831,22 @@ itest!(deno_run_non_existent { exit_code: 1, }); +itest!(deno_run_no_bin_entrypoint { + args: "run -A --quiet npm:@denotest/esm-basic", + output: "npm/deno_run_no_bin_entrypoint.out", + envs: env_vars_for_npm_tests(), + http_server: true, + exit_code: 1, +}); + +itest!(deno_run_no_bin_entrypoint_non_existent_subpath { + args: "run -A --quiet npm:@denotest/esm-basic/non-existent.js", + output: "npm/deno_run_no_bin_entrypoint_non_existent_subpath.out", + envs: env_vars_for_npm_tests(), + http_server: true, + exit_code: 1, +}); + itest!(directory_import_folder_index_js { args: "run npm/directory_import/folder_index_js.ts", output: "npm/directory_import/folder_index_js.out", diff --git a/cli/tests/testdata/npm/deno_run_no_bin_entrypoint.out b/cli/tests/testdata/npm/deno_run_no_bin_entrypoint.out new file mode 100644 index 000000000..b878bc70c --- /dev/null +++ b/cli/tests/testdata/npm/deno_run_no_bin_entrypoint.out @@ -0,0 +1 @@ +error: package '@denotest/esm-basic' did not have a bin property in its package.json diff --git a/cli/tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out b/cli/tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out new file mode 100644 index 000000000..06d7292b0 --- /dev/null +++ b/cli/tests/testdata/npm/deno_run_no_bin_entrypoint_non_existent_subpath.out @@ -0,0 +1,3 @@ +error: package '@denotest/esm-basic' did not have a bin property in its package.json + +Fallback failed: Cannot find module 'file:///[WILDCARD]/non-existent.js' diff --git a/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/cli-cjs.js b/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/cli-cjs.js new file mode 100644 index 000000000..7b6ba2724 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/cli-cjs.js @@ -0,0 +1,5 @@ +const process = require("process"); + +for (const arg of process.argv.slice(2)) { + console.log(arg); +} diff --git a/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/cli.mjs b/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/cli.mjs new file mode 100644 index 000000000..0ae8e9190 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/cli.mjs @@ -0,0 +1,5 @@ +import process from "node:process"; + +for (const arg of process.argv.slice(2)) { + console.log(arg); +} diff --git a/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/package.json b/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/package.json new file mode 100644 index 000000000..db50464bc --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/bin/0.6.0/package.json @@ -0,0 +1,4 @@ +{ + "name": "@deno/bin", + "version": "0.6.0" +} |