summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
diff options
context:
space:
mode:
authorbartOssh <lenart.consulting@gmail.com>2020-03-23 16:37:24 +0100
committerGitHub <noreply@github.com>2020-03-23 11:37:24 -0400
commitec0738606753b34525988fd9f58a23cb300b7bc0 (patch)
tree4a0bdc3585b2e64f50c739d49eba1e5cd9c3ee1d /cli/tests/integration_tests.rs
parenta0ba476feef9dcc1b3bbd5144d2e48ef5053ee09 (diff)
feat: first pass at "deno upgrade" (#4328)
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r--cli/tests/integration_tests.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index ba1880b80..ed5160565 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -168,6 +168,30 @@ fn fmt_stdin_error() {
assert!(!output.status.success());
}
+// Warning: this test requires internet access.
+#[test]
+fn upgrade_in_tmpdir() {
+ let temp_dir = TempDir::new().unwrap();
+ let exe_path = if cfg!(windows) {
+ temp_dir.path().join("deno")
+ } else {
+ temp_dir.path().join("deno.exe")
+ };
+ let _ = std::fs::copy(util::deno_exe_path(), &exe_path).unwrap();
+ assert!(exe_path.exists());
+ let _mtime1 = std::fs::metadata(&exe_path).unwrap().modified().unwrap();
+ let status = Command::new(&exe_path)
+ .arg("upgrade")
+ .arg("--force")
+ .spawn()
+ .unwrap()
+ .wait()
+ .unwrap();
+ assert!(status.success());
+ let _mtime2 = std::fs::metadata(&exe_path).unwrap().modified().unwrap();
+ // TODO(ry) assert!(mtime1 < mtime2);
+}
+
#[test]
fn installer_test_local_module_run() {
let temp_dir = TempDir::new().expect("tempdir fail");