Repository navigation
Conversation
PriorityQueue#peekBottom() returned the last slot of the heap, which is not necessarily the largest element, so MockTimers#runAll() could stop before the timer that fires last. Scan the leaves of the heap for the largest element instead. Assisted-by: a closed-source coding agent Signed-off-by: Yarchik <spoko.dev@gmail.com>
|
Review requested:
|
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. Caution AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context. |
What?
Fixes
t.mock.timers.runAll()skipping the longest timer when it's scheduled before shorter ones.For example, timers scheduled at 9999, 8888, and 8888 ms only execute the two shorter callbacks.
Why?
PriorityQueue#peekBottom()returns the last element of the heap, which isn't necessarily the largest.How?
Update
peekBottom()to find the largest element among the heap's leaves.Added a regression test based on the existing documentation example.
test/parallel/test-runner-mock-timers.jspasses (62/62) with the fix, and the new test fails without it. I ran it against a nightly build with the changed files loaded, not a full local build. ESLint passes on the changed files.AI assistance was used to investigate and implement the fix. I reviewed the changes and test results.