1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
denoland-deno/tests/specs/test/worker_large_output/main.js
Matt Mastracci 9c0446567b
fix(cli): Identify and fix a test deadlock (#23411)
If a worker tried to flush large amounts of data right as the test was
ending, it could cause the flush sync marker to get lost.
2024-04-16 15:14:59 -06:00

15 lines
516 B
JavaScript

// 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();
})
);
});