summaryrefslogtreecommitdiff
path: root/tests/specs/worker/worker_async_error
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs/worker/worker_async_error')
-rw-r--r--tests/specs/worker/worker_async_error/__test__.jsonc5
-rw-r--r--tests/specs/worker/worker_async_error/async_error.ts4
-rw-r--r--tests/specs/worker/worker_async_error/worker_async_error.ts5
-rw-r--r--tests/specs/worker/worker_async_error/worker_async_error.ts.out7
4 files changed, 21 insertions, 0 deletions
diff --git a/tests/specs/worker/worker_async_error/__test__.jsonc b/tests/specs/worker/worker_async_error/__test__.jsonc
new file mode 100644
index 000000000..0e48d3f32
--- /dev/null
+++ b/tests/specs/worker/worker_async_error/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "run -A --quiet --reload worker_async_error.ts",
+ "output": "worker_async_error.ts.out",
+ "exitCode": 1
+}
diff --git a/tests/specs/worker/worker_async_error/async_error.ts b/tests/specs/worker/worker_async_error/async_error.ts
new file mode 100644
index 000000000..154b957b1
--- /dev/null
+++ b/tests/specs/worker/worker_async_error/async_error.ts
@@ -0,0 +1,4 @@
+// deno-lint-ignore require-await
+(async () => {
+ throw new Error("bar");
+})();
diff --git a/tests/specs/worker/worker_async_error/worker_async_error.ts b/tests/specs/worker/worker_async_error/worker_async_error.ts
new file mode 100644
index 000000000..7941a5bbe
--- /dev/null
+++ b/tests/specs/worker/worker_async_error/worker_async_error.ts
@@ -0,0 +1,5 @@
+const worker = new Worker(
+ import.meta.resolve("./async_error.ts"),
+ { type: "module", name: "foo" },
+);
+setTimeout(() => worker.terminate(), 30000);
diff --git a/tests/specs/worker/worker_async_error/worker_async_error.ts.out b/tests/specs/worker/worker_async_error/worker_async_error.ts.out
new file mode 100644
index 000000000..8d017859c
--- /dev/null
+++ b/tests/specs/worker/worker_async_error/worker_async_error.ts.out
@@ -0,0 +1,7 @@
+error: Uncaught (in worker "foo") (in promise) Error: bar
+ throw new Error("bar");
+ ^
+ at [WILDCARD]/async_error.ts:[WILDCARD]
+ at [WILDCARD]/async_error.ts:[WILDCARD]
+error: Uncaught (in promise) Error: Unhandled error in child worker.
+ at Worker.#pollControl [WILDCARD]