summaryrefslogtreecommitdiff
path: root/tests/specs/install/future_install_local_add_deno
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/future_install_local_add_deno
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/future_install_local_add_deno')
-rw-r--r--tests/specs/install/future_install_local_add_deno/__test__.jsonc24
-rw-r--r--tests/specs/install/future_install_local_add_deno/deno.json1
-rw-r--r--tests/specs/install/future_install_local_add_deno/deno.json.out5
-rw-r--r--tests/specs/install/future_install_local_add_deno/install.out4
-rw-r--r--tests/specs/install/future_install_local_add_deno/main.js2
5 files changed, 36 insertions, 0 deletions
diff --git a/tests/specs/install/future_install_local_add_deno/__test__.jsonc b/tests/specs/install/future_install_local_add_deno/__test__.jsonc
new file mode 100644
index 000000000..eaafafbdd
--- /dev/null
+++ b/tests/specs/install/future_install_local_add_deno/__test__.jsonc
@@ -0,0 +1,24 @@
+{
+ "tempDir": true,
+ "envs": {
+ "DENO_FUTURE": "1"
+ },
+ "steps": [
+ {
+ "args": "install npm:@denotest/esm-basic",
+ "output": "install.out"
+ },
+ {
+ // make sure the dep got cached
+ "args": "run --cached-only main.js",
+ "output": ""
+ },
+ {
+ "args": [
+ "eval",
+ "console.log(Deno.readTextFileSync('deno.json').trim())"
+ ],
+ "output": "deno.json.out"
+ }
+ ]
+}
diff --git a/tests/specs/install/future_install_local_add_deno/deno.json b/tests/specs/install/future_install_local_add_deno/deno.json
new file mode 100644
index 000000000..0967ef424
--- /dev/null
+++ b/tests/specs/install/future_install_local_add_deno/deno.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/specs/install/future_install_local_add_deno/deno.json.out b/tests/specs/install/future_install_local_add_deno/deno.json.out
new file mode 100644
index 000000000..0172071c3
--- /dev/null
+++ b/tests/specs/install/future_install_local_add_deno/deno.json.out
@@ -0,0 +1,5 @@
+{
+ "imports": {
+ "@denotest/esm-basic": "npm:@denotest/esm-basic@^1.0.0"
+ }
+}
diff --git a/tests/specs/install/future_install_local_add_deno/install.out b/tests/specs/install/future_install_local_add_deno/install.out
new file mode 100644
index 000000000..df58284fc
--- /dev/null
+++ b/tests/specs/install/future_install_local_add_deno/install.out
@@ -0,0 +1,4 @@
+⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag.
+Add @denotest/esm-basic - npm:@denotest/esm-basic@^1.0.0
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
diff --git a/tests/specs/install/future_install_local_add_deno/main.js b/tests/specs/install/future_install_local_add_deno/main.js
new file mode 100644
index 000000000..c29b48b4e
--- /dev/null
+++ b/tests/specs/install/future_install_local_add_deno/main.js
@@ -0,0 +1,2 @@
+import { setValue } from "@denotest/esm-basic";
+setValue(5);