diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/mod.rs | 12 | ||||
-rw-r--r-- | cli/tests/testdata/error_cause.ts | 13 | ||||
-rw-r--r-- | cli/tests/testdata/error_cause.ts.out | 17 | ||||
-rw-r--r-- | cli/tests/testdata/error_cause_recursive.ts | 4 | ||||
-rw-r--r-- | cli/tests/testdata/error_cause_recursive.ts.out | 14 |
5 files changed, 60 insertions, 0 deletions
diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index 8dd50b2f3..150683749 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -464,6 +464,18 @@ fn broken_stdout() { assert!(!stderr.contains("panic")); } +itest!(error_cause { + args: "run error_cause.ts", + output: "error_cause.ts.out", + exit_code: 1, +}); + +itest!(error_cause_recursive { + args: "run error_cause_recursive.ts", + output: "error_cause_recursive.ts.out", + exit_code: 1, +}); + itest_flaky!(cafile_url_imports { args: "run --quiet --reload --cert tls/RootCA.pem cafile_url_imports.ts", output: "cafile_url_imports.ts.out", diff --git a/cli/tests/testdata/error_cause.ts b/cli/tests/testdata/error_cause.ts new file mode 100644 index 000000000..7ebd5a48a --- /dev/null +++ b/cli/tests/testdata/error_cause.ts @@ -0,0 +1,13 @@ +function a() { + throw new Error("foo", { cause: new Error("bar", { cause: "deno" }) }); +} + +function b() { + a(); +} + +function c() { + b(); +} + +c(); diff --git a/cli/tests/testdata/error_cause.ts.out b/cli/tests/testdata/error_cause.ts.out new file mode 100644 index 000000000..155ef656e --- /dev/null +++ b/cli/tests/testdata/error_cause.ts.out @@ -0,0 +1,17 @@ +[WILDCARD] +error: Uncaught Error: foo + throw new Error("foo", { cause: new Error("bar", { cause: "deno" }) }); + ^ + at a (file:///[WILDCARD]/error_cause.ts:2:9) + at b (file:///[WILDCARD]/error_cause.ts:6:3) + at c (file:///[WILDCARD]/error_cause.ts:10:3) + at file:///[WILDCARD]/error_cause.ts:13:1 +Caused by: Uncaught Error: bar + throw new Error("foo", { cause: new Error("bar", { cause: "deno" }) }); + ^ + at a (file:///[WILDCARD]/error_cause.ts:2:35) + at b (file:///[WILDCARD]/error_cause.ts:6:3) + at c (file:///[WILDCARD]/error_cause.ts:10:3) + at file:///[WILDCARD]/error_cause.ts:13:1 +Caused by: Uncaught deno +[WILDCARD]
\ No newline at end of file diff --git a/cli/tests/testdata/error_cause_recursive.ts b/cli/tests/testdata/error_cause_recursive.ts new file mode 100644 index 000000000..a6999b1ff --- /dev/null +++ b/cli/tests/testdata/error_cause_recursive.ts @@ -0,0 +1,4 @@ +const x = new Error("foo"); +const y = new Error("bar", { cause: x }); +x.cause = y; +throw y; diff --git a/cli/tests/testdata/error_cause_recursive.ts.out b/cli/tests/testdata/error_cause_recursive.ts.out new file mode 100644 index 000000000..8bfda02fb --- /dev/null +++ b/cli/tests/testdata/error_cause_recursive.ts.out @@ -0,0 +1,14 @@ +[WILDCARD] +error: Uncaught Error: bar +const y = new Error("bar", { cause: x }); + ^ + at file:///[WILDCARD]/error_cause_recursive.ts:2:11 +Caused by: Uncaught Error: foo +const x = new Error("foo"); + ^ + at file:///[WILDCARD]/error_cause_recursive.ts:1:11 +Caused by: Uncaught Error: bar +const y = new Error("bar", { cause: x }); + ^ + at file:///[WILDCARD]/error_cause_recursive.ts:2:11 +[WILDCARD]
\ No newline at end of file |