summaryrefslogtreecommitdiff
path: root/tests/specs/install/no_future_install_global
diff options
context:
space:
mode:
authorBartek Iwańczuk <biwanczuk@gmail.com>2024-05-08 20:34:46 +0100
committerGitHub <noreply@github.com>2024-05-08 12:34:46 -0700
commit4e23a5b1fc2ba0e26f1832a2c374a1f3aef9e7ff (patch)
tree4e71d07cce253b3a8035285e11999c1294643074 /tests/specs/install/no_future_install_global
parent525b3c8d746b8eb358ed6466cd4b68ebd6542392 (diff)
FUTURE: `deno install` changes (#23498)
This PR implements the changes we plan to make to `deno install` in deno 2.0. - `deno install` without arguments caches dependencies from `package.json` / `deno.json` and sets up the `node_modules` folder - `deno install <pkg>` adds the package to the config file (either `package.json` or `deno.json`), i.e. it aliases `deno add` - `deno add` can also add deps to `package.json` (this is gated behind `DENO_FUTURE` due to uncertainty around handling projects with both `deno.json` and `package.json`) - `deno install -g <bin>` installs a package as a globally available binary (the same as `deno install <bin>` in 1.0) --------- Co-authored-by: Nathan Whitaker <nathan@deno.com>
Diffstat (limited to 'tests/specs/install/no_future_install_global')
-rw-r--r--tests/specs/install/no_future_install_global/__test__.jsonc13
-rw-r--r--tests/specs/install/no_future_install_global/assert.js11
-rw-r--r--tests/specs/install/no_future_install_global/install.out5
-rw-r--r--tests/specs/install/no_future_install_global/main.js3
-rw-r--r--tests/specs/install/no_future_install_global/package.json6
5 files changed, 38 insertions, 0 deletions
diff --git a/tests/specs/install/no_future_install_global/__test__.jsonc b/tests/specs/install/no_future_install_global/__test__.jsonc
new file mode 100644
index 000000000..ca351ee0d
--- /dev/null
+++ b/tests/specs/install/no_future_install_global/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install --root ./bins --name deno-test-bin ./main.js",
+ "output": "install.out"
+ },
+ {
+ "args": "run -A ./assert.js",
+ "output": ""
+ }
+ ]
+}
diff --git a/tests/specs/install/no_future_install_global/assert.js b/tests/specs/install/no_future_install_global/assert.js
new file mode 100644
index 000000000..c7a6a0680
--- /dev/null
+++ b/tests/specs/install/no_future_install_global/assert.js
@@ -0,0 +1,11 @@
+const dirs = Deno.readDir("./bins/bin");
+
+let found = false;
+for await (const entry of dirs) {
+ if (entry.name.includes("deno-test-bin")) {
+ found = true;
+ }
+}
+if (!found) {
+ throw new Error("Failed to find test bin");
+}
diff --git a/tests/specs/install/no_future_install_global/install.out b/tests/specs/install/no_future_install_global/install.out
new file mode 100644
index 000000000..f3a394c6f
--- /dev/null
+++ b/tests/specs/install/no_future_install_global/install.out
@@ -0,0 +1,5 @@
+⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag.
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+✅ Successfully installed deno-test-bin[WILDCARD]
+[WILDCARD]
diff --git a/tests/specs/install/no_future_install_global/main.js b/tests/specs/install/no_future_install_global/main.js
new file mode 100644
index 000000000..6268d7136
--- /dev/null
+++ b/tests/specs/install/no_future_install_global/main.js
@@ -0,0 +1,3 @@
+import { setValue } from "npm:@denotest/esm-basic";
+
+setValue(5);
diff --git a/tests/specs/install/no_future_install_global/package.json b/tests/specs/install/no_future_install_global/package.json
new file mode 100644
index 000000000..9f465ad50
--- /dev/null
+++ b/tests/specs/install/no_future_install_global/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "deno-test-bin",
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}