feat(timers): implement node:timers/promises setTimeout/setImmediate (#1213)#1449
Merged
Conversation
…1213) setTimeout(delay, value?) and setImmediate(value?) from node:timers/promises were unimplemented stubs that threw 'not yet implemented'. Wire them to the existing promise-returning timer primitive js_set_timeout_value so they return a Promise that resolves with value (or undefined). setTimeout takes (delay, value); registering the export arity makes the closure dispatch pad a missing value with undefined. setImmediate resolves with value on a later turn (0-delay). Flips test_parity_timers_promises to PASS (removed from known_failures) and node-suite/timers/promises/shadowed-global-fast-paths (the stale expected- output snapshot recording the stub error is removed so it compares against live Node). setInterval/scheduler async-iterator + AbortSignal paths remain (other #1213 sub-gaps).
4 tasks
proggeramlug
added a commit
that referenced
this pull request
May 23, 2026
…es (#1458) Rolls up 22 PRs that merged to main post-v0.5.1025 without per-PR version bumps. - node:timers epic (#1213, 6 PRs #1449-#1455): node:timers/promises setTimeout/setImmediate, numeric-id clear*, namespace import, ref() typeof, Symbol.dispose, global setImmediate/clearImmediate. - node:perf_hooks fan-out (10 PRs across #1320 #1327 #1337-#1340 #1388-#1390 #1403): typeof methods, performance singleton identity, nodeTiming, toJSON, clearResourceTimings, structured-clone detail, observer arg + buffered + throw cases. - node:json lazy-tape closes #1424 (#1447) — JSON.parse reviver on lazy-tape arrays no longer SIGSEGVs (test un-skip-listed). - #1448 console.log/util.inspect on lazy-tape arrays materialises before formatting. - #1429 GC unsafe-zone guards for fastify/hyper handlers. - #1341 codegen: Any-typed .includes()/.indexOf() dynamic dispatch. - #1370 perry/ui web driver debug noise dropped. #1423 (AsyncLocalStorage .enterWith/.exit) remains skip-listed.
This was referenced May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
node:timers/promisessetTimeout(delay, value?)andsetImmediate(value?)were unimplemented stubs that threw'… is not yet implemented', soawait setTimeout(ms)/await setTimeout(ms, value)never resolved (part of the #1213 node:timers parity tracker / #793).Both are now wired to the existing promise-returning timer primitive
js_set_timeout_value, returning a Promise that resolves withvalue(orundefined).setTimeoutis registered with arity 2 so the closure dispatch pads a missingvaluearg withundefined;setImmediateresolves on a later turn (0-delay). No closure synthesis needed — composes the existing tested timer→promise plumbing.Test
test_parity_timers_promisesto PASS (removed fromknown_failures.json).node-suite/timers/promises/shadowed-global-fast-pathsto PASS — removed the staletest-parity/expected/snapshot that recorded the old stub error, so it now compares against live Node (both producesetTimeout resolved object {"a":1}/setImmediate resolved object {"b":2}).Remaining #1213 sub-gaps (separate follow-ups):
setIntervalasync-iterator,scheduler/AbortSignalpaths, numeric timer clears, and timer-callbackthisbinding.Refs #1213.