Commit f501db85560 for nodejs

commit f501db85560bc3f821b4ebc115ec7477f7f45ba9
Author: Yuya Inoue <65857152+inoway46@users.noreply.github.com>
Date:   Tue Nov 10 06:26:34 2026 +0900

    test: deflake test-runner-mock-timers-scheduler

    The first test case checked that the mocked `scheduler.wait(4000)`
    resolved within 100ms of real wall-clock time. On slow or busy CI
    machines the time between `Date.now()` and the promise callback can
    exceed 100ms even though the mock works, so the test failed with
    "time should be advanced less than the 100ms".

    Replace the wall-clock assertion with a deterministic check: after
    `tick(4000)`, wait one turn of the event loop and assert the promise
    has settled. A real 4000ms timer cannot fire within that window, so
    the check still proves the mocked timer was used. This matches how the
    other cases in the file verify the mock.

    Refs: https://github.com/nodejs/reliability/issues/1354
    Refs: https://github.com/nodejs/reliability/issues/1278
    Signed-off-by: inoway46 <inoueyuya416@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/67296
    Refs: https://github.com/nodejs/node/actions/runs/42153384377
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Chemi Atlow <chemi@atlow.co.il>

diff --git a/test/parallel/test-runner-mock-timers-scheduler.js b/test/parallel/test-runner-mock-timers-scheduler.js
index fa019221fc8..7f6d66e0734 100644
--- a/test/parallel/test-runner-mock-timers-scheduler.js
+++ b/test/parallel/test-runner-mock-timers-scheduler.js
@@ -7,22 +7,20 @@ const { it, describe } = require('node:test');
 const nodeTimersPromises = require('node:timers/promises');

 describe('Mock Timers Scheduler Test Suite', () => {
-  it('should advance in time and trigger timers when calling the .tick function', (t) => {
+  it('should advance in time and trigger timers when calling the .tick function', async (t) => {
     t.mock.timers.enable({ apis: ['scheduler.wait'] });

-    const now = Date.now();
-    const durationAtMost = 100;
+    const fn = t.mock.fn();

-    const p = nodeTimersPromises.scheduler.wait(4000);
+    nodeTimersPromises.scheduler.wait(4000).then(fn).then(common.mustCall());
     t.mock.timers.tick(4000);

-    return p.then(common.mustCall((result) => {
-      assert.strictEqual(result, undefined);
-      assert.ok(
-        Date.now() - now < durationAtMost,
-        `time should be advanced less than the ${durationAtMost}ms`
-      );
-    }));
+    // A real 4000ms timer cannot fire within a single turn of the event loop,
+    // so the promise being settled here proves the mocked timer was used.
+    await nodeTimersPromises.setImmediate();
+
+    assert.strictEqual(fn.mock.callCount(), 1);
+    assert.deepStrictEqual(fn.mock.calls[0].arguments, [undefined]);
   });

   it('should advance in time and trigger timers when calling the .tick function multiple times', async (t) => {