Skip to content

Commit 96edbb4

Browse files
committed
test_runner: fix mock timer promisified setInterval return value
promisified setInterval can be passed a value that is returned by the async iterable. The mocked promisified setInterval used this value for its own purposes. This brings the mocked version in line with the original. Fixes: #50307
1 parent f9c72dc commit 96edbb4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

lib/internal/test_runner/mock/mock_timers.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class MockTimers {
119119
this.#executionQueue.removeAt(position);
120120
}
121121

122-
async * #setIntervalPromisified(interval, startTime, options) {
122+
async * #setIntervalPromisified(interval, result, options) {
123123
const context = this;
124124
const emitter = new EventEmitter();
125125
if (options?.signal) {
@@ -143,8 +143,7 @@ class MockTimers {
143143

144144
const eventIt = EventEmitter.on(emitter, 'data');
145145
const callback = () => {
146-
startTime += interval;
147-
emitter.emit('data', startTime);
146+
emitter.emit('data', result);
148147
};
149148

150149
const timerId = this.#createTimer(true, callback, interval, options);

0 commit comments

Comments
 (0)