From ff71ef81751da1babdc4f9d1df5c279e7c64f305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 16 Dec 2022 17:11:10 +0100 Subject: fix(repl): errors shouldn't terminate repl (#17082) This commit changes REPL to never surface errors coming from code execution, but instead print them as errors to the REPL itself. --- cli/tests/repl_tests.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'cli/tests') diff --git a/cli/tests/repl_tests.rs b/cli/tests/repl_tests.rs index a5c64f3b6..d64871bb0 100644 --- a/cli/tests/repl_tests.rs +++ b/cli/tests/repl_tests.rs @@ -940,7 +940,7 @@ mod repl { true, vec!["repl", "--quiet", "--allow-read", "--allow-env"], Some(vec![r#"export {} from "npm:chalk";"#]), - Some(env_vars), + Some(env_vars.clone()), true, ); @@ -948,5 +948,21 @@ mod repl { assert_contains!(out, "Chalk: [Function: Chalk],"); assert!(err.is_empty()); } + + { + let (out, err) = util::run_and_collect_output_with_args( + true, + vec!["repl", "--quiet", "--allow-read", "--allow-env"], + Some(vec![r#"import foo from "npm:asdfawe52345asdf""#]), + Some(env_vars), + true, + ); + + assert_contains!( + out, + "error: npm package 'asdfawe52345asdf' does not exist" + ); + assert!(err.is_empty()); + } } } -- cgit v1.2.3