zerojs.package
README.md
zerojs_async tests
Exercises the per-VM asynchronous foundation: the event loop (microtask queue, timers, coroutine driver), the shared millisecond clock rt.nowMs, and the JS-visible queueMicrotask global.
Two layers of coverage:
- JS-level, through the public
zerojs.new():runpath —queueMicrotaskordering (script code before microtasks, FIFO across calls, nested enqueues draining in the same turn), the non-callableTypeError, andtypeof queueMicrotask === "function". Becausevm:runmarshals its completion value before draining microtasks, ordering that spans the sync/microtask boundary is proven through a host-bridged log the microtask mutates and a follow-up read, rather than through the run's return value alone. - Luau-level, probing the loop object directly via
require("zerojs.event_loop")against a real realm fromrequire("zerojs.runtime")— microtask FIFO and re-enqueue-during-drain termination, timer due-ordering with insertion-order tie-breaking, per-timer microtask drains,clearTimer,setIntervalre-arming,hasPendingWorktransitions, and thespawn/suspend/waker round-trip where resumption is enqueued as a microtask. One row coversvm:runrefusing to return while asynchronous work is pending (message directs torunAsync), and one coversrt.nowMsreturning a millisecond-resolution recent epoch.