diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-11-17 22:46:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-17 22:46:15 -0500 |
commit | c213ad380f349dee1f65e6d9a9f7a8fa669b2af2 (patch) | |
tree | 9265e433c2691bf39c699617b87f755c1d025908 /test_util/src/lib.rs | |
parent | 4a2d8c4bbd20cc282b4df42fe5da6414447315e0 (diff) |
chore: combine `TestCommandBuilder` with `DenoCmd` (#21248)
Diffstat (limited to 'test_util/src/lib.rs')
-rw-r--r-- | test_util/src/lib.rs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 24be651d1..97ae46479 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -83,7 +83,6 @@ mod npm; pub mod pty; pub use builders::DenoChild; -pub use builders::DenoCmd; pub use builders::TestCommandBuilder; pub use builders::TestCommandOutput; pub use builders::TestContext; @@ -2099,7 +2098,7 @@ pub fn run_and_collect_output_with_args( need_http_server: bool, ) -> (String, String) { let mut deno_process_builder = deno_cmd() - .args(args) + .args_vec(args) .current_dir(testdata_path()) .stdin(Stdio::piped()) .piped_output(); @@ -2139,18 +2138,15 @@ pub fn new_deno_dir() -> TempDir { TempDir::new() } -pub fn deno_cmd() -> DenoCmd { +pub fn deno_cmd() -> TestCommandBuilder { let deno_dir = new_deno_dir(); deno_cmd_with_deno_dir(&deno_dir) } -pub fn deno_cmd_with_deno_dir(deno_dir: &TempDir) -> DenoCmd { - let exe_path = deno_exe_path(); - assert!(exe_path.exists()); - let mut cmd = Command::new(exe_path); - cmd.env("DENO_DIR", deno_dir.path()); - cmd.env("NPM_CONFIG_REGISTRY", npm_registry_unset_url()); - DenoCmd::new_raw(deno_dir.clone(), cmd) +pub fn deno_cmd_with_deno_dir(deno_dir: &TempDir) -> TestCommandBuilder { + TestCommandBuilder::new(deno_dir.clone()) + .env("DENO_DIR", deno_dir.path()) + .env("NPM_CONFIG_REGISTRY", npm_registry_unset_url()) } pub fn run_powershell_script_file( @@ -2227,7 +2223,7 @@ impl<'a> CheckOutputIntegrationTest<'a> { command_builder = command_builder.args_vec(self.args_vec.clone()); } if let Some(input) = &self.input { - command_builder = command_builder.stdin(input); + command_builder = command_builder.stdin_text(input); } for (key, value) in &self.envs { command_builder = command_builder.env(key, value); @@ -2236,7 +2232,7 @@ impl<'a> CheckOutputIntegrationTest<'a> { command_builder = command_builder.env_clear(); } if let Some(cwd) = &self.cwd { - command_builder = command_builder.cwd(cwd); + command_builder = command_builder.current_dir(cwd); } command_builder.run() |