summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-04-21 14:06:57 -0400
committerGitHub <noreply@github.com>2019-04-21 14:06:57 -0400
commit8ba6e4fa137059a77ceed88de937bbb6c5276c45 (patch)
tree4169fe3ce3b86a85006627cecd95655c127d1ddb
parent961f87e1c5d0cbe312a02997123e65fc315afb06 (diff)
Fix flaky tests (#2164)
-rw-r--r--js/timers_test.ts16
1 files changed, 5 insertions, 11 deletions
diff --git a/js/timers_test.ts b/js/timers_test.ts
index b43817437..51dfbd7e0 100644
--- a/js/timers_test.ts
+++ b/js/timers_test.ts
@@ -58,10 +58,9 @@ test(async function timeoutCancelSuccess() {
let count = 0;
const id = setTimeout(() => {
count++;
- }, 500);
+ }, 1);
// Cancelled, count should not increment
clearTimeout(id);
- // Wait a bit longer than 500ms
await waitForMs(600);
assertEquals(count, 0);
});
@@ -113,19 +112,14 @@ test(async function intervalSuccess() {
let count = 0;
const id = setInterval(() => {
count++;
- if (count === 2) {
- // TODO: clearInterval(id) here alone seems not working
- // causing unit_tests.ts to block forever
- // Requires further investigation...
- clearInterval(id);
- resolve();
- }
- }, 200);
+ clearInterval(id);
+ resolve();
+ }, 100);
await promise;
// Clear interval
clearInterval(id);
// count should increment twice
- assertEquals(count, 2);
+ assertEquals(count, 1);
});
test(async function intervalCancelSuccess() {