API reference › @evolu/common › Time › testCreateTime
function testCreateTime(options?: {
autoIncrement?: "microtask" | "sync";
startAt?: number &
Brand<"NonNaN"> &
Brand<"Finite"> &
Brand<"Int"> &
Brand<"NonNegative"> &
Brand<"LessThan281474976710655"> &
Brand<"Millis">;
}): TestTime;
Defined in: packages/common/src/Time.ts:217
Creates a TestTime with controllable timers for testing.
Time starts at startAt (default 0) and only advances when advance() is
called. Timeouts scheduled via setTimeout fire when time is advanced past
their deadline.
Set autoIncrement to automatically increment time by 1ms after each
wall-clock or performance now() call. "microtask" increments after the
current turn, while "sync" increments immediately after each read. Omit it
to keep time fixed until advance() is called.