mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
timers: remove flaky setInterval test
PR-URL: https://github.com/nodejs/node/pull/37227 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
eb08afdf24
commit
eb7ec1b257
1 file changed
-22
@@ -348,28 +348,6 @@ process.on('multipleResolves', common.mustNotCall());
|
||||
assert.strictEqual(loopCount, 5);
|
||||
}));
|
||||
}
|
||||
|
||||
{
|
||||
// Check that if we abort when we have some callbacks left,
|
||||
// we actually call them.
|
||||
const controller = new AbortController();
|
||||
const { signal } = controller;
|
||||
const delay = 10;
|
||||
let totalIterations = 0;
|
||||
const timeoutLoop = runInterval(async (iterationNumber) => {
|
||||
if (iterationNumber === 2) {
|
||||
await setTimeout(delay * 2);
|
||||
controller.abort();
|
||||
}
|
||||
if (iterationNumber > totalIterations) {
|
||||
totalIterations = iterationNumber;
|
||||
}
|
||||
}, delay, signal);
|
||||
|
||||
timeoutLoop.catch(common.mustCall(() => {
|
||||
assert.ok(totalIterations >= 3, `iterations was ${totalIterations} < 3`);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user