Skip to content

Commit

Permalink
test_runner: fix mocked setInterval using the wrong interval
Browse files Browse the repository at this point in the history
mocked setInterval used the wrong increment when scheduling the new
timer.

Fixes: nodejs#50382
  • Loading branch information
mika-fischer committed Oct 25, 2023
1 parent eee8da9 commit eed178d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/test_runner/mock/mock_timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class MockTimers {
id: timerId,
callback,
runAt: this.#now + delay,
interval: isInterval,
interval: isInterval ? delay : undefined,
args,
});

Expand Down Expand Up @@ -621,7 +621,7 @@ class MockTimers {

this.#executionQueue.shift();

if (timer.interval) {
if (timer.interval !== undefined) {
timer.runAt += timer.interval;
this.#executionQueue.insert(timer);
}
Expand Down

0 comments on commit eed178d

Please sign in to comment.