diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-06-12 16:06:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 16:06:41 -0700 |
commit | a7531361ef9bcc29b31ca73b68eeae707ea91f22 (patch) | |
tree | ea212f7d1fc4bc20d1facf6434672afecaffefe4 /tests/specs/install | |
parent | b30e5c09859000896a0caf52e78b0cbdb58955ef (diff) |
fix(cli): Explicitly cache NPM packages during `deno install` (#24190)
Fixes a regression introduced in
https://github.com/denoland/deno/pull/24170, where we wouldn't actually
set up the node modules dir on `deno install` if there was an up to date
deno lockfile present.
Previously we were relying on the fact that resolving pending module
resolution called `cache_packages` (which sets up the node modules dir).
When pending resolutions were removed, and the `resolve_pending`
function with it, we also removed the `cache_packages` call needed to
set up node modules.
Diffstat (limited to 'tests/specs/install')
-rw-r--r-- | tests/specs/install/future_install_node_modules/__test__.jsonc | 38 | ||||
-rw-r--r-- | tests/specs/install/future_install_node_modules/install_lockfile.out | 2 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/specs/install/future_install_node_modules/__test__.jsonc b/tests/specs/install/future_install_node_modules/__test__.jsonc index 571216557..c705ad0f8 100644 --- a/tests/specs/install/future_install_node_modules/__test__.jsonc +++ b/tests/specs/install/future_install_node_modules/__test__.jsonc @@ -25,6 +25,44 @@ } ] }, + "install_sets_up_node_modules_with_lockfile": { + "tempDir": true, + "envs": { + "DENO_FUTURE": "1" + }, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + // check for lockfile + "args": [ + "eval", + "console.log(Deno.readTextFileSync('./deno.lock').trim())" + ], + "output": "deno.lock.out" + }, + { + // remove the lockfile + "args": [ + "eval", + "Deno.removeSync('node_modules', {recursive: true});" + ], + "output": "" + }, + { + // install, this time should use the lockfile + "args": "install", + "output": "install_lockfile.out" + }, + { + // make sure we created the node_modules dir + "args": ["eval", "Deno.statSync('node_modules')"], + "output": "" + } + ] + }, "install_errors_corrupted_lockfile": { "tempDir": true, "envs": { diff --git a/tests/specs/install/future_install_node_modules/install_lockfile.out b/tests/specs/install/future_install_node_modules/install_lockfile.out new file mode 100644 index 000000000..3e27e3d20 --- /dev/null +++ b/tests/specs/install/future_install_node_modules/install_lockfile.out @@ -0,0 +1,2 @@ +⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag. +Initialize @denotest/esm-basic@1.0.0 |