mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
Fix cafile_install_remote_module test (#4429)
This commit is contained in:
parent
3ef34673c9
commit
392d2c1118
1 changed files with 8 additions and 23 deletions
|
@ -1518,13 +1518,9 @@ fn cafile_fetch() {
|
||||||
drop(g);
|
drop(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ry) Re-enable this broken test.
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
|
||||||
fn cafile_install_remote_module() {
|
fn cafile_install_remote_module() {
|
||||||
pub use deno::test_util::*;
|
pub use deno::test_util::*;
|
||||||
use std::env;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
|
@ -1545,33 +1541,22 @@ fn cafile_install_remote_module() {
|
||||||
.arg("https://localhost:5545/cli/tests/echo.ts")
|
.arg("https://localhost:5545/cli/tests/echo.ts")
|
||||||
.output()
|
.output()
|
||||||
.expect("Failed to spawn script");
|
.expect("Failed to spawn script");
|
||||||
|
assert!(install_output.status.success());
|
||||||
|
|
||||||
let code = install_output.status.code();
|
let mut echo_test_path = temp_dir.path().join("echo_test");
|
||||||
assert_eq!(Some(0), code);
|
|
||||||
|
|
||||||
let mut file_path = temp_dir.path().join("echo_test");
|
|
||||||
if cfg!(windows) {
|
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 output = Command::new(echo_test_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)
|
|
||||||
.current_dir(temp_dir.path())
|
.current_dir(temp_dir.path())
|
||||||
.arg("foo")
|
.arg("foo")
|
||||||
.env(path_var_name, path_var_value)
|
.env("PATH", util::target_dir())
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to spawn script");
|
.expect("failed to spawn script");
|
||||||
assert!(std::str::from_utf8(&output.stdout)
|
let stdout = std::str::from_utf8(&output.stdout).unwrap().trim();
|
||||||
.unwrap()
|
assert!(stdout.ends_with("foo"));
|
||||||
.trim()
|
|
||||||
.ends_with("foo"));
|
|
||||||
|
|
||||||
drop(deno_dir);
|
drop(deno_dir);
|
||||||
drop(temp_dir);
|
drop(temp_dir);
|
||||||
|
|
Loading…
Reference in a new issue