1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-26 09:10:40 -05:00
denoland-deno/tests/testdata/test/sanitizer/ops_sanitizer_timeout_failure.ts
Matt Mastracci c92717a1a4
chore(cli): pre-factor the sanitizer tests (#22436)
Moving tests around so that we can make #22413 smaller
2024-02-16 10:49:42 -07:00

22 lines
497 B
TypeScript

let intervalHandle: number;
let firstIntervalPromise: Promise<void>;
addEventListener("load", () => {
firstIntervalPromise = new Promise((resolve) => {
let firstIntervalCalled = false;
intervalHandle = setInterval(() => {
if (!firstIntervalCalled) {
resolve();
firstIntervalCalled = true;
}
}, 5);
});
});
addEventListener("unload", () => {
clearInterval(intervalHandle);
});
Deno.test("wait", async function () {
await firstIntervalPromise;
});