summaryrefslogtreecommitdiff
path: root/tests/specs/lockfile
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-05-23 12:31:05 -0700
committerGitHub <noreply@github.com>2024-05-23 12:31:05 -0700
commit5de30c53239ac74843725d981afc0bb8c45bdf16 (patch)
tree5e806923d8806d6648a9d991eeb3bb05d1df8b4f /tests/specs/lockfile
parent20dad295e2e0961932b05d34b29b07ee97eb0815 (diff)
fix(cli): Support deno.lock with only package.json present + fix DENO_FUTURE install interactions with lockfile (#23918)
Fixes #23571. Previously, we required a `deno.json` to be present (or the `--lock` flag) in order for us to resolve a `deno.lock` file. This meant that if you were using deno in an npm-first project deno wouldn't use a lockfile. Additionally, while I was fixing that, I discovered there were a couple bugs keeping the future `install` command from using a lockfile. With this PR, `install` will actually resolve the lockfile (or create one if not present), and update it if it's not up-to-date. This also speeds up `deno install`, as we can use the lockfile to skip work during npm resolution.
Diffstat (limited to 'tests/specs/lockfile')
-rw-r--r--tests/specs/lockfile/only_package_json/__test__.jsonc16
-rw-r--r--tests/specs/lockfile/only_package_json/cache.out3
-rw-r--r--tests/specs/lockfile/only_package_json/deno.lock.out19
-rw-r--r--tests/specs/lockfile/only_package_json/index.js1
-rw-r--r--tests/specs/lockfile/only_package_json/package.json7
5 files changed, 46 insertions, 0 deletions
diff --git a/tests/specs/lockfile/only_package_json/__test__.jsonc b/tests/specs/lockfile/only_package_json/__test__.jsonc
new file mode 100644
index 000000000..6b28a7a92
--- /dev/null
+++ b/tests/specs/lockfile/only_package_json/__test__.jsonc
@@ -0,0 +1,16 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "cache index.js",
+ "output": "cache.out"
+ },
+ {
+ "args": [
+ "eval",
+ "console.log(Deno.readTextFileSync('./deno.lock').trim())"
+ ],
+ "output": "deno.lock.out"
+ }
+ ]
+}
diff --git a/tests/specs/lockfile/only_package_json/cache.out b/tests/specs/lockfile/only_package_json/cache.out
new file mode 100644
index 000000000..b8114c12a
--- /dev/null
+++ b/tests/specs/lockfile/only_package_json/cache.out
@@ -0,0 +1,3 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
diff --git a/tests/specs/lockfile/only_package_json/deno.lock.out b/tests/specs/lockfile/only_package_json/deno.lock.out
new file mode 100644
index 000000000..b30232996
--- /dev/null
+++ b/tests/specs/lockfile/only_package_json/deno.lock.out
@@ -0,0 +1,19 @@
+{
+ "version": "3",
+ "packages": {
+ "specifiers": {
+ "npm:@denotest/esm-basic": "npm:@denotest/esm-basic@1.0.0"
+ },
+ "npm": {
+ "@denotest/esm-basic@1.0.0": [WILDCARD]
+ }
+ },
+ "remote": {},
+ "workspace": {
+ "packageJson": {
+ "dependencies": [
+ "npm:@denotest/esm-basic"
+ ]
+ }
+ }
+}
diff --git a/tests/specs/lockfile/only_package_json/index.js b/tests/specs/lockfile/only_package_json/index.js
new file mode 100644
index 000000000..2600083e2
--- /dev/null
+++ b/tests/specs/lockfile/only_package_json/index.js
@@ -0,0 +1 @@
+import * as basic from "@denotest/esm-basic";
diff --git a/tests/specs/lockfile/only_package_json/package.json b/tests/specs/lockfile/only_package_json/package.json
new file mode 100644
index 000000000..6611f206f
--- /dev/null
+++ b/tests/specs/lockfile/only_package_json/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "lockfile_only_package_json",
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ },
+ "type": "module"
+}