diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-03-30 10:43:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 10:43:16 -0400 |
commit | e0429e2ad641e9207e00838de209ce33b3562f70 (patch) | |
tree | 496c38dadb79c4dc9ae4eea755e2ac6a65440ad4 /test_util/src/lib.rs | |
parent | 3deade4b14de809f67ed0471f8e91c91b25fedcc (diff) |
fix(repl): improve package.json support (#18497)
1. Fixes a cosmetic issue in the repl where it would display lsp warning
messages.
2. Lazily loads dependencies from the package.json on use.
3. Supports using bare specifiers from package.json in the REPL.
Closes #17929
Closes #18494
Diffstat (limited to 'test_util/src/lib.rs')
-rw-r--r-- | test_util/src/lib.rs | 24 |
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 { |