summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/workers/close_nested_parent.js
diff options
context:
space:
mode:
authorAndreu Botella <abb@randomunok.com>2021-09-25 04:26:57 +0200
committerGitHub <noreply@github.com>2021-09-24 19:26:57 -0700
commit1a6249c9717288e37873b692abac831f11c30f4e (patch)
treee8962a090909ac3187237319732ffb41b8a61a38 /cli/tests/testdata/workers/close_nested_parent.js
parent4e2b59f9df5085025f08faea24e76b009e47f68d (diff)
chore(workers): Test that closing a worker closes any child workers (#12215)
Before #12156, closing a worker which had children would cause a panic (https://github.com/denoland/deno/issues/11342#issuecomment-918327693). After that PR, closing a worker will also close any child workers.
Diffstat (limited to 'cli/tests/testdata/workers/close_nested_parent.js')
-rw-r--r--cli/tests/testdata/workers/close_nested_parent.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/testdata/workers/close_nested_parent.js b/cli/tests/testdata/workers/close_nested_parent.js
new file mode 100644
index 000000000..c528632ce
--- /dev/null
+++ b/cli/tests/testdata/workers/close_nested_parent.js
@@ -0,0 +1,13 @@
+// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
+
+console.log("Starting the parent worker");
+
+new Worker(
+ new URL("./close_nested_child.js", import.meta.url),
+ { type: "module" },
+);
+
+self.addEventListener("message", () => {
+ console.log("Closing");
+ self.close();
+});