mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
Fix flaky tests (#2139)
This commit is contained in:
parent
f20b05af24
commit
1a69df4a05
4 changed files with 4 additions and 17 deletions
|
@ -132,11 +132,9 @@ test(async function intervalCancelSuccess() {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const id = setInterval(() => {
|
const id = setInterval(() => {
|
||||||
count++;
|
count++;
|
||||||
}, 500);
|
}, 1);
|
||||||
// Cancelled, count should not increment
|
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
// Wait a bit longer than 500ms
|
await waitForMs(500);
|
||||||
await waitForMs(600);
|
|
||||||
assertEquals(count, 0);
|
assertEquals(count, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -150,9 +148,9 @@ test(async function intervalOrdering() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
timers[i] = setTimeout(onTimeout, 20);
|
timers[i] = setTimeout(onTimeout, 1);
|
||||||
}
|
}
|
||||||
await waitForMs(100);
|
await waitForMs(500);
|
||||||
assertEquals(timeouts, 1);
|
assertEquals(timeouts, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
args: --reload tests/010_set_interval.ts
|
|
||||||
output: tests/010_set_interval.ts.out
|
|
|
@ -1,7 +0,0 @@
|
||||||
const id = setInterval(() => {
|
|
||||||
console.log("test");
|
|
||||||
}, 200);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
clearInterval(id);
|
|
||||||
}, 500);
|
|
|
@ -1,2 +0,0 @@
|
||||||
test
|
|
||||||
test
|
|
Loading…
Reference in a new issue