diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-12-20 12:00:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-20 12:00:57 -0500 |
commit | 8165cded14abd82d5f5995c0660a8a046c91630e (patch) | |
tree | b71ce2b9bfd3d826ff19de94f1c4becab9d0c1a2 /cli/tests/install_tests.rs | |
parent | a06f59981b95d011f162e595031574c83586c84a (diff) |
fix: ignore local lockfile for deno install and uninstall (#17145)
Closes #17116
Diffstat (limited to 'cli/tests/install_tests.rs')
-rw-r--r-- | cli/tests/install_tests.rs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/cli/tests/install_tests.rs b/cli/tests/install_tests.rs index 4016b6373..3d799ce53 100644 --- a/cli/tests/install_tests.rs +++ b/cli/tests/install_tests.rs @@ -16,6 +16,9 @@ mod install { let temp_dir = TempDir::new(); let temp_dir_str = temp_dir.path().to_string_lossy().to_string(); + // ensure a lockfile doesn't get created or updated locally + temp_dir.write("deno.json", "{}"); + let status = util::deno_cmd() .current_dir(temp_dir.path()) .arg("install") @@ -34,6 +37,9 @@ mod install { .unwrap(); assert!(status.success()); + // no lockfile should be created locally + assert!(!temp_dir.path().join("deno.lock").exists()); + let mut file_path = temp_dir.path().join(".deno/bin/echo_test"); assert!(file_path.exists()); @@ -41,7 +47,7 @@ mod install { file_path = file_path.with_extension("cmd"); } - let content = fs::read_to_string(file_path).unwrap(); + let content = fs::read_to_string(&file_path).unwrap(); // ensure there's a trailing newline so the shell script can be // more versatile. assert_eq!(content.chars().last().unwrap(), '\n'); @@ -57,6 +63,27 @@ mod install { r#"run --check 'http://localhost:4545/echo.ts'"# ); } + + // now uninstall + let status = util::deno_cmd() + .current_dir(temp_dir.path()) + .arg("uninstall") + .arg("echo_test") + .envs([ + ("HOME", temp_dir_str.as_str()), + ("USERPROFILE", temp_dir_str.as_str()), + ("DENO_INSTALL_ROOT", ""), + ]) + .spawn() + .unwrap() + .wait() + .unwrap(); + assert!(status.success()); + + // ensure local lockfile still doesn't exist + assert!(!temp_dir.path().join("deno.lock").exists()); + // ensure uninstall occurred + assert!(!file_path.exists()); } #[test] |