From 78ac19f51f48984ea16f97a0c574fa507544b8d5 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Wed, 7 Jul 2021 05:33:06 +0800 Subject: fix(repl): do not panic when Deno.inspect throws (#11292) --- cli/tests/integration/repl_tests.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'cli/tests') diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index 00be42ac3..43ab32232 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -611,3 +611,24 @@ fn assign_underscore_error() { )); assert!(err.is_empty()); } + +#[test] +fn custom_inspect() { + let (out, err) = util::run_and_collect_output( + true, + "repl", + Some(vec![ + r#"const o = { + [Symbol.for("Deno.customInspect")]() { + throw new Error('Oops custom inspect error'); + }, + };"#, + "o", + ]), + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), + false, + ); + + assert!(out.contains("Oops custom inspect error")); + assert!(err.is_empty()); +} -- cgit v1.2.3