diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-03-19 12:46:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 12:46:56 -0400 |
commit | 392d2c11182332b8d3c168169b1585e3419cb1eb (patch) | |
tree | a6b9c82e39f18e9d083dbb05d60467aba0431c1c /cli/tests/integration_tests.rs | |
parent | 3ef34673c9b92aa3c54dfccb37c06b82d6fb3eab (diff) |
Fix cafile_install_remote_module test (#4429)
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r-- | cli/tests/integration_tests.rs | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 51f849ff6..1cbc26db0 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1518,13 +1518,9 @@ fn cafile_fetch() { drop(g); } -// TODO(ry) Re-enable this broken test. #[test] -#[ignore] fn cafile_install_remote_module() { pub use deno::test_util::*; - use std::env; - use std::path::PathBuf; use std::process::Command; use tempfile::TempDir; @@ -1545,33 +1541,22 @@ fn cafile_install_remote_module() { .arg("https://localhost:5545/cli/tests/echo.ts") .output() .expect("Failed to spawn script"); + assert!(install_output.status.success()); - let code = install_output.status.code(); - assert_eq!(Some(0), code); - - let mut file_path = temp_dir.path().join("echo_test"); + let mut echo_test_path = temp_dir.path().join("echo_test"); if cfg!(windows) { - file_path = file_path.with_extension(".cmd"); + echo_test_path = echo_test_path.with_extension("cmd"); } - assert!(file_path.exists()); + assert!(echo_test_path.exists()); - let path_var_name = if cfg!(windows) { "Path" } else { "PATH" }; - let paths_var = env::var_os(path_var_name).expect("PATH not set"); - let mut paths: Vec<PathBuf> = env::split_paths(&paths_var).collect(); - paths.push(temp_dir.path().to_owned()); - paths.push(util::target_dir()); - let path_var_value = env::join_paths(paths).expect("Can't create PATH"); - - let output = Command::new(file_path) + let output = Command::new(echo_test_path) .current_dir(temp_dir.path()) .arg("foo") - .env(path_var_name, path_var_value) + .env("PATH", util::target_dir()) .output() .expect("failed to spawn script"); - assert!(std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .ends_with("foo")); + let stdout = std::str::from_utf8(&output.stdout).unwrap().trim(); + assert!(stdout.ends_with("foo")); drop(deno_dir); drop(temp_dir); |