From 36ad4e3b771356d30e0a43b2c43b85e69ce348cc Mon Sep 17 00:00:00 2001 From: Divya Date: Mon, 4 May 2020 06:35:00 -0500 Subject: fix(install): Propagate --unstable flag (#5061) --- cli/installer.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'cli/installer.rs') 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); @@ -354,6 +359,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"); -- cgit v1.2.3