summaryrefslogtreecommitdiff
path: root/tests/specs/test/unhandled_rejection
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs/test/unhandled_rejection')
-rw-r--r--tests/specs/test/unhandled_rejection/__test__.jsonc5
-rw-r--r--tests/specs/test/unhandled_rejection/main.out22
-rw-r--r--tests/specs/test/unhandled_rejection/main.ts3
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/specs/test/unhandled_rejection/__test__.jsonc b/tests/specs/test/unhandled_rejection/__test__.jsonc
new file mode 100644
index 000000000..d8887f753
--- /dev/null
+++ b/tests/specs/test/unhandled_rejection/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "test main.ts",
+ "output": "main.out",
+ "exitCode": 1
+}
diff --git a/tests/specs/test/unhandled_rejection/main.out b/tests/specs/test/unhandled_rejection/main.out
new file mode 100644
index 000000000..e708ae20c
--- /dev/null
+++ b/tests/specs/test/unhandled_rejection/main.out
@@ -0,0 +1,22 @@
+Check [WILDCARD]/main.ts
+Uncaught error from ./main.ts FAILED
+
+ ERRORS
+
+./main.ts (uncaught error)
+error: (in promise) Error: rejection
+ reject(new Error("rejection"));
+ ^
+ at [WILDCARD]/main.ts:2:10
+ at new Promise (<anonymous>)
+ at [WILDCARD]/main.ts:1:1
+This error was not caught from a test and caused the test runner to fail on the referenced module.
+It most likely originated from a dangling promise, event/timeout handler or top-level code.
+
+ FAILURES
+
+./main.ts (uncaught error)
+
+FAILED | 0 passed | 1 failed ([WILDCARD])
+
+error: Test failed
diff --git a/tests/specs/test/unhandled_rejection/main.ts b/tests/specs/test/unhandled_rejection/main.ts
new file mode 100644
index 000000000..32f3111ea
--- /dev/null
+++ b/tests/specs/test/unhandled_rejection/main.ts
@@ -0,0 +1,3 @@
+new Promise((_resolve, reject) => {
+ reject(new Error("rejection"));
+});