From e0429e2ad641e9207e00838de209ce33b3562f70 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 30 Mar 2023 10:43:16 -0400 Subject: 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 --- test_util/src/lib.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'test_util/src/lib.rs') 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 { -- cgit v1.2.3