summaryrefslogtreecommitdiff
path: root/test_util/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'test_util/src/lib.rs')
-rw-r--r--test_util/src/lib.rs24
1 files changed, 6 insertions, 18 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs
index b38d72cd9..c844e594f 100644
--- a/test_util/src/lib.rs
+++ b/test_util/src/lib.rs
@@ -2166,24 +2166,12 @@ pub fn pattern_match(pattern: &str, s: &str, wildcard: &str) -> bool {
t.1.is_empty()
}
-pub fn with_pty(deno_args: &[&str], mut action: impl FnMut(Pty)) {
- if !Pty::is_supported() {
- return;
- }
-
- let deno_dir = new_deno_dir();
- let mut env_vars = std::collections::HashMap::new();
- env_vars.insert("NO_COLOR".to_string(), "1".to_string());
- env_vars.insert(
- "DENO_DIR".to_string(),
- deno_dir.path().to_string_lossy().to_string(),
- );
- action(Pty::new(
- &deno_exe_path(),
- deno_args,
- &testdata_path(),
- Some(env_vars),
- ))
+pub fn with_pty(deno_args: &[&str], action: impl FnMut(Pty)) {
+ let context = TestContextBuilder::default().build();
+ context
+ .new_command()
+ .args_vec(deno_args.iter().map(ToString::to_string).collect())
+ .with_pty(action);
}
pub struct WrkOutput {