summaryrefslogtreecommitdiff
path: root/tests/specs/test/worker_large_output/main.js
blob: 0941e60f3b8501a3856bf9db9bbe7e68a859d0fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Regression test for workers that post large amounts of output as a test is ending. This
// test should not deadlock, though the output is undefined.
Deno.test(async function workerOutput() {
  console.log("Booting worker");
  const code =
    "self.postMessage(0); console.log(`hello from worker\n`.repeat(60000));";
  const worker = new Worker(URL.createObjectURL(new Blob([code])), {
    type: "module",
  });
  await new Promise((r) =>
    worker.addEventListener("message", () => {
      r();
    })
  );
});