summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/run_tests.rs5
-rw-r--r--cli/tests/testdata/unhandled_rejection_sync_error.ts6
-rw-r--r--cli/tests/testdata/unhandled_rejection_sync_error.ts.out6
3 files changed, 17 insertions, 0 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 25d84ae46..29e424aae 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -2787,3 +2787,8 @@ itest!(unhandled_rejection {
args: "run --check unhandled_rejection.ts",
output: "unhandled_rejection.ts.out",
});
+
+itest!(unhandled_rejection_sync_error {
+ args: "run --check unhandled_rejection_sync_error.ts",
+ output: "unhandled_rejection_sync_error.ts.out",
+});
diff --git a/cli/tests/testdata/unhandled_rejection_sync_error.ts b/cli/tests/testdata/unhandled_rejection_sync_error.ts
new file mode 100644
index 000000000..0dabb1cb7
--- /dev/null
+++ b/cli/tests/testdata/unhandled_rejection_sync_error.ts
@@ -0,0 +1,6 @@
+globalThis.addEventListener("unhandledrejection", (e) => {
+ console.log("unhandled rejection at:", e.promise, "reason:", e.reason);
+ e.preventDefault();
+});
+
+throw new Error("boom!");
diff --git a/cli/tests/testdata/unhandled_rejection_sync_error.ts.out b/cli/tests/testdata/unhandled_rejection_sync_error.ts.out
new file mode 100644
index 000000000..270319824
--- /dev/null
+++ b/cli/tests/testdata/unhandled_rejection_sync_error.ts.out
@@ -0,0 +1,6 @@
+[WILDCARD]
+unhandled rejection at: Promise {
+ <rejected> Error: boom!
+ at file:///[WILDCARD]testdata/unhandled_rejection_sync_error.ts:6:7
+} reason: Error: boom!
+ at file:///[WILDCARD]testdata/unhandled_rejection_sync_error.ts:6:7