summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/run/unstable_worker_options.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/testdata/run/unstable_worker_options.js')
-rw-r--r--cli/tests/testdata/run/unstable_worker_options.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/tests/testdata/run/unstable_worker_options.js b/cli/tests/testdata/run/unstable_worker_options.js
new file mode 100644
index 000000000..213eb3ee6
--- /dev/null
+++ b/cli/tests/testdata/run/unstable_worker_options.js
@@ -0,0 +1,19 @@
+const scope = import.meta.url.slice(-7) === "#worker" ? "worker" : "main";
+
+new Worker(`data:application/javascript;base64,${btoa(`postMessage("ok");`)}`, {
+ type: "module",
+ deno: {
+ permissions: {
+ read: true,
+ },
+ },
+}).onmessage = ({ data }) => {
+ console.log(scope, data);
+
+ if (scope === "main") {
+ const worker = new Worker(`${import.meta.url}#worker`, { type: "module" });
+ worker.onmessage = () => Deno.exit(0);
+ } else {
+ postMessage("done");
+ }
+};