diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-01-10 09:22:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-10 09:22:03 -0500 |
commit | ea86c0818ab6bf15d648726f0b18204a1dc83709 (patch) | |
tree | 1b26268cd6134ef65ec60ddc1439d9634651d27f /cli/tools/installer.rs | |
parent | c487b7ed54a36edcf324005a6ff6e76663544e06 (diff) |
fix: install shim with `--allow-all` should not output each permission individually (#13325)
Diffstat (limited to 'cli/tools/installer.rs')
-rw-r--r-- | cli/tools/installer.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index ac164a2f3..b65de2615 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -730,6 +730,43 @@ mod tests { } #[test] + fn install_allow_all() { + 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 { + allow_all: true, + ..Flags::default() + }, + InstallFlags { + module_url: "http://localhost:4545/echo_server.ts".to_string(), + args: vec![], + name: Some("echo_test".to_string()), + root: Some(temp_dir.path().to_path_buf()), + force: false, + }, + ) + .unwrap(); + + let mut file_path = bin_dir.join("echo_test"); + if cfg!(windows) { + file_path = file_path.with_extension("cmd"); + } + + let content = fs::read_to_string(file_path).unwrap(); + if cfg!(windows) { + assert!(content.contains( + r#""run" "--allow-all" "http://localhost:4545/echo_server.ts""# + )); + } else { + assert!(content + .contains(r#"run --allow-all 'http://localhost:4545/echo_server.ts'"#)); + } + } + + #[test] fn install_local_module() { let temp_dir = TempDir::new().expect("tempdir fail"); let bin_dir = temp_dir.path().join("bin"); |