summaryrefslogtreecommitdiff
path: root/cli/tests/integration
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-05-22 16:55:04 -0400
committerGitHub <noreply@github.com>2023-05-22 16:55:04 -0400
commit7b4c483aa159794cdb9d57d3252c2980fba45469 (patch)
treeb1c3b0ab080e98ab20f470fbad5b1aba05045dfb /cli/tests/integration
parent612226de8e2fe3068d981866242bacedfceb9734 (diff)
fix(npm): store npm binary command resolution in lockfile (#19219)
Part of #19038 Closes #19034 (eliminates the time spent re-resolving)
Diffstat (limited to 'cli/tests/integration')
-rw-r--r--cli/tests/integration/npm_tests.rs13
-rw-r--r--cli/tests/integration/run_tests.rs31
2 files changed, 36 insertions, 8 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index 40214315a..73ac029df 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -723,6 +723,19 @@ itest!(deno_run_bin_cjs {
http_server: true,
});
+#[test]
+fn deno_run_bin_lockfile() {
+ let context = TestContextBuilder::for_npm().use_temp_cwd().build();
+ let temp_dir = context.temp_dir();
+ temp_dir.write("deno.json", "{}");
+ let output = context
+ .new_command()
+ .args("run -A --quiet npm:@denotest/bin/cli-esm this is a test")
+ .run();
+ output.assert_matches_file("npm/deno_run_esm.out");
+ assert!(temp_dir.path().join("deno.lock").exists());
+}
+
itest!(deno_run_non_existent {
args: "run npm:mkdirp@0.5.125",
output: "npm/deno_run_non_existent.out",
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index eecf8537f..31b541e1c 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -3030,14 +3030,29 @@ itest!(package_json_auto_discovered_no_package_json_imports {
copy_temp_dir: Some("run/with_package_json/no_deno_json"),
});
-itest!(package_json_with_deno_json {
- args: "run --quiet -A main.ts",
- output: "package_json/deno_json/main.out",
- cwd: Some("package_json/deno_json/"),
- copy_temp_dir: Some("package_json/deno_json/"),
- envs: env_vars_for_npm_tests_no_sync_download(),
- http_server: true,
-});
+#[test]
+fn package_json_with_deno_json() {
+ let context = TestContextBuilder::for_npm()
+ .use_copy_temp_dir("package_json/deno_json/")
+ .cwd("package_json/deno_json/")
+ .build();
+ let output = context.new_command().args("run --quiet -A main.ts").run();
+ output.assert_matches_file("package_json/deno_json/main.out");
+
+ assert!(context
+ .temp_dir()
+ .path()
+ .join("package_json/deno_json/deno.lock")
+ .exists());
+
+ // run again and ensure the top level install doesn't happen twice
+ let output = context
+ .new_command()
+ .args("run --log-level=debug -A main.ts")
+ .run();
+ let output = output.combined_output();
+ assert_contains!(output, "Skipping top level install.");
+}
#[test]
fn package_json_error_dep_value_test() {