summaryrefslogtreecommitdiff
path: root/cli/tests/integration/npm_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-04-12 18:04:45 -0400
committerGitHub <noreply@github.com>2023-04-12 18:04:45 -0400
commit17e4782140a602043c4f92e643c1908c521ae017 (patch)
treec9e3cc979bbde41aec9c2615ee5d13a7d6784aab /cli/tests/integration/npm_tests.rs
parenta3c5193a2e7d15bbfac390b220982561376e7322 (diff)
fix(npm): eagerly reload package information when version from lockfile not found locally (#18673)
Closes #18624
Diffstat (limited to 'cli/tests/integration/npm_tests.rs')
-rw-r--r--cli/tests/integration/npm_tests.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index 35f3980e4..4c6c217e6 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -1761,4 +1761,38 @@ fn reload_info_not_found_cache_but_exists_remote() {
));
output.assert_exit_code(0);
}
+
+ // now try using a lockfile
+ {
+ // create it
+ temp_dir.write("deno.json", r#"{}"#);
+ test_context.new_command().args("cache main.ts").run();
+ assert!(temp_dir.path().join("deno.lock").exists());
+
+ // remove a version found in the lockfile
+ remove_version_for_package(deno_dir, "@denotest/esm-basic", "1.0.0");
+
+ // should error for --cached-only
+ let output = test_context
+ .new_command()
+ .args("run --cached-only main.ts")
+ .run();
+ output.assert_matches_text(concat!(
+ "error: failed reading lockfile '[WILDCARD]deno.lock'\n",
+ "\n",
+ "Caused by:\n",
+ " Could not find '@denotest/esm-basic@1.0.0' specified in the lockfile.\n"
+ ));
+ output.assert_exit_code(1);
+
+ // now try running, it should work and only initialize the new package
+ let output = test_context.new_command().args("run main.ts").run();
+ output.assert_matches_text(concat!(
+ "Download http://localhost:4545/npm/registry/@denotest/cjs-default-export\n",
+ "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n",
+ "Download http://localhost:4545/npm/registry/@denotest/esm-import-cjs-default\n",
+ "Node esm importing node cjs\n[WILDCARD]",
+ ));
+ output.assert_exit_code(0);
+ }
}