diff options
| author | Jason <m.jason.liu@outlook.com> | 2022-09-02 19:38:06 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-02 13:38:06 +0200 |
| commit | 8178665bd1877a55a4e82b07d6ac4a749c8a9c1c (patch) | |
| tree | 74ba2bf20abbe3ba44080b9177489ff117b097f7 /cli/tests | |
| parent | a74b2ecf379ddb1ff03c61d4e876153d7b4c45d2 (diff) | |
fix(cli/repl): await Promise.any([])... (#15623)
Diffstat (limited to 'cli/tests')
| -rw-r--r-- | cli/tests/integration/repl_tests.rs | 14 | ||||
| -rw-r--r-- | cli/tests/unit/console_test.ts | 11 |
2 files changed, 25 insertions, 0 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index 07b7575a0..cdeb36c9c 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -861,3 +861,17 @@ fn repl_report_error() { assert_contains!(out, "1\n2\nundefined\n"); assert!(err.is_empty()); } + +#[test] +fn pty_aggregate_error() { + let (out, err) = util::run_and_collect_output( + true, + "repl", + Some(vec!["await Promise.any([])"]), + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), + false, + ); + + assert_contains!(out, "AggregateError"); + assert!(err.is_empty()); +} diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 1b364eda1..1faef6bd7 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -2027,3 +2027,14 @@ Deno.test(function inspectStringAbbreviation() { '[ "This is a ..." ]', ); }); + +Deno.test(async function inspectAggregateError() { + try { + await Promise.any([]); + } catch (err) { + assertEquals( + Deno.inspect(err).trimEnd(), + "AggregateError: All promises were rejected", + ); + } +}); |
