Log inGet started
World

ZeroJS

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():run path — queueMicrotask ordering (script code before microtasks, FIFO across calls, nested enqueues draining in the same turn), the non-callable TypeError, and typeof queueMicrotask === "function". Because vm:run marshals 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 from require("zerojs.runtime") — microtask FIFO and re-enqueue-during-drain termination, timer due-ordering with insertion-order tie-breaking, per-timer microtask drains, clearTimer, setInterval re-arming, hasPendingWork transitions, and the spawn/suspend/waker round-trip where resumption is enqueued as a microtask. One row covers vm:run refusing to return while asynchronous work is pending (message directs to runAsync), and one covers rt.nowMs returning a millisecond-resolution recent epoch.