summaryrefslogtreecommitdiff
path: root/cli/installer.rs
diff options
context:
space:
mode:
authorDivya <hello@shortdiv.com>2020-05-04 06:35:00 -0500
committerGitHub <noreply@github.com>2020-05-04 13:35:00 +0200
commit36ad4e3b771356d30e0a43b2c43b85e69ce348cc (patch)
tree86329f0828ac6db6cfd7ab73f09507d403cffc8c /cli/installer.rs
parenta913b7a1ba67849464d0314eee9851f59c22556b (diff)
fix(install): Propagate --unstable flag (#5061)
Diffstat (limited to 'cli/installer.rs')
-rw-r--r--cli/installer.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/cli/installer.rs b/cli/installer.rs
index e402b8d03..e16c9f892 100644
--- a/cli/installer.rs
+++ b/cli/installer.rs
@@ -208,6 +208,11 @@ pub fn install(
executable_args.push(log_level.to_string());
}
}
+
+ if flags.unstable {
+ executable_args.push("--unstable".to_string());
+ }
+
executable_args.push(module_url.to_string());
executable_args.extend_from_slice(&args);
@@ -355,6 +360,39 @@ mod tests {
}
#[test]
+ fn install_unstable() {
+ let temp_dir = TempDir::new().expect("tempdir fail");
+ let bin_dir = temp_dir.path().join("bin");
+ std::fs::create_dir(&bin_dir).unwrap();
+
+ install(
+ Flags {
+ unstable: true,
+ ..Flags::default()
+ },
+ "http://localhost:4545/cli/tests/echo_server.ts",
+ vec![],
+ Some("echo_test".to_string()),
+ Some(temp_dir.path().to_path_buf()),
+ false,
+ )
+ .expect("Install failed");
+
+ let mut file_path = bin_dir.join("echo_test");
+ if cfg!(windows) {
+ file_path = file_path.with_extension("cmd");
+ }
+
+ assert!(file_path.exists());
+
+ let content = fs::read_to_string(file_path).unwrap();
+ println!("this is the file path {:?}", content);
+ assert!(content.contains(
+ r#""run" "--unstable" "http://localhost:4545/cli/tests/echo_server.ts"#
+ ));
+ }
+
+ #[test]
fn install_inferred_name() {
let temp_dir = TempDir::new().expect("tempdir fail");
let bin_dir = temp_dir.path().join("bin");