diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-12-16 17:11:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-16 17:11:10 +0100 |
commit | ff71ef81751da1babdc4f9d1df5c279e7c64f305 (patch) | |
tree | 246cb7e45de792f1d87b2cb6071ae0d44d5f15fc /cli/tests/repl_tests.rs | |
parent | d7f4298015bd98ba5806ec48ee35e4be61a4143e (diff) |
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.
Diffstat (limited to 'cli/tests/repl_tests.rs')
-rw-r--r-- | cli/tests/repl_tests.rs | 18 |
1 files changed, 17 insertions, 1 deletions
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()); + } } } |