summaryrefslogtreecommitdiff
path: root/cli/tests/testdata
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/testdata')
-rw-r--r--cli/tests/testdata/error_cause.ts13
-rw-r--r--cli/tests/testdata/error_cause.ts.out17
-rw-r--r--cli/tests/testdata/error_cause_recursive.ts4
-rw-r--r--cli/tests/testdata/error_cause_recursive.ts.out14
4 files changed, 48 insertions, 0 deletions
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