summaryrefslogtreecommitdiff
path: root/cli/tests/integration/repl_tests.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-04-28 14:21:55 +0100
committerGitHub <noreply@github.com>2023-04-28 15:21:55 +0200
commit0b296c6378c46c18de7c3838b2a3e1d13eb9bd87 (patch)
tree19e2e9697ccda1808997bede87493dc0f257a8a2 /cli/tests/integration/repl_tests.rs
parent84b921555fa481a0a2c4cffe5c897fd1c87485b7 (diff)
fix(repl): don't panic on undefined exception (#18888)
Fixes regression from #18878 where `Promise.reject()`, `Promise.reject(undefined)` and `reportError(undefined)` panic in the REPL. Fixes `throw undefined` printing `Uncaught Unknown exception` instead of `Uncaught undefined`.
Diffstat (limited to 'cli/tests/integration/repl_tests.rs')
-rw-r--r--cli/tests/integration/repl_tests.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs
index d9966fe8f..f8987e20b 100644
--- a/cli/tests/integration/repl_tests.rs
+++ b/cli/tests/integration/repl_tests.rs
@@ -825,6 +825,20 @@ fn repl_report_error() {
}
#[test]
+fn repl_error_undefined() {
+ util::with_pty(&["repl"], |mut console| {
+ console.write_line(r#"throw undefined;"#);
+ console.expect("Uncaught undefined");
+ console.write_line(r#"Promise.reject();"#);
+ console.expect("Promise { <rejected> undefined }");
+ console.expect("Uncaught (in promise) undefined");
+ console.write_line(r#"reportError(undefined);"#);
+ console.expect("undefined");
+ console.expect("Uncaught undefined");
+ });
+}
+
+#[test]
fn pty_aggregate_error() {
util::with_pty(&["repl"], |mut console| {
console.write_line("await Promise.any([])");