summaryrefslogtreecommitdiff
path: root/cli/tests/integration/install_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration/install_tests.rs')
-rw-r--r--cli/tests/integration/install_tests.rs59
1 files changed, 55 insertions, 4 deletions
diff --git a/cli/tests/integration/install_tests.rs b/cli/tests/integration/install_tests.rs
index ebe587301..44b418e10 100644
--- a/cli/tests/integration/install_tests.rs
+++ b/cli/tests/integration/install_tests.rs
@@ -41,9 +41,11 @@ fn install_basic() {
assert_eq!(content.chars().last().unwrap(), '\n');
if cfg!(windows) {
- assert!(content.contains(r#""run" "http://localhost:4545/echo.ts""#));
+ assert!(
+ content.contains(r#""run" "--check" "http://localhost:4545/echo.ts""#)
+ );
} else {
- assert!(content.contains(r#"run 'http://localhost:4545/echo.ts'"#));
+ assert!(content.contains(r#"run --check 'http://localhost:4545/echo.ts'"#));
}
}
@@ -79,9 +81,11 @@ fn install_custom_dir_env_var() {
let content = fs::read_to_string(file_path).unwrap();
if cfg!(windows) {
- assert!(content.contains(r#""run" "http://localhost:4545/echo.ts""#));
+ assert!(
+ content.contains(r#""run" "--check" "http://localhost:4545/echo.ts""#)
+ );
} else {
- assert!(content.contains(r#"run 'http://localhost:4545/echo.ts'"#));
+ assert!(content.contains(r#"run --check 'http://localhost:4545/echo.ts'"#));
}
}
@@ -157,3 +161,50 @@ fn installer_test_remote_module_run() {
.trim()
.ends_with("hello, foo"));
}
+
+#[test]
+fn check_local_by_default() {
+ let _guard = util::http_server();
+ let temp_dir = TempDir::new();
+ let temp_dir_str = temp_dir.path().to_string_lossy().to_string();
+
+ let status = util::deno_cmd()
+ .current_dir(temp_dir.path())
+ .arg("install")
+ .arg(util::testdata_path().join("./install/check_local_by_default.ts"))
+ .envs([
+ ("HOME", temp_dir_str.as_str()),
+ ("USERPROFILE", temp_dir_str.as_str()),
+ ("DENO_INSTALL_ROOT", ""),
+ ])
+ .status()
+ .unwrap();
+ assert!(status.success());
+}
+
+#[test]
+fn check_local_by_default2() {
+ let _guard = util::http_server();
+ let temp_dir = TempDir::new();
+ let temp_dir_str = temp_dir.path().to_string_lossy().to_string();
+
+ let output = util::deno_cmd()
+ .current_dir(temp_dir.path())
+ .arg("install")
+ .arg(util::testdata_path().join("./install/check_local_by_default2.ts"))
+ .envs([
+ ("HOME", temp_dir_str.as_str()),
+ ("NO_COLOR", "1"),
+ ("USERPROFILE", temp_dir_str.as_str()),
+ ("DENO_INSTALL_ROOT", ""),
+ ])
+ .output()
+ .unwrap();
+ assert!(!output.status.success());
+ let stdout = String::from_utf8(output.stdout).unwrap();
+ let stderr = String::from_utf8(output.stderr).unwrap();
+ assert!(stdout.is_empty());
+ assert!(stderr.contains(
+ r#"error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'."#
+ ));
+}