Repository navigation
Commit 7667a8f
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: nodejs/reliability#1354
Refs: nodejs/reliability#1278
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: #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>1 parent b7aab20 commit 7667a8f
1 file changed
Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
0 commit comments