/** * The spec-process half of `freezeClock` (see `DefineOptions.freezeClock`). * * `freezeClock` has always pinned the BROWSER clock (`page.clock.setFixedTime`), * but capture specs routinely compute fixture values in the SPEC's Node process — * a module-level `const GENERATED_AT = new Date().toISOString()` runs before any * test executes, outside the browser freeze. Such a value differs between the * base and the head capture run (separate processes, minutes or days apart), so * any surface rendering it as text drifts in width and shows up in the diff as a * phantom computed-style change on an unrelated PR. The in-run self-check cannot * catch this class: both of its captures share one spec process and therefore * one value. * * `styleproof-map` sets `STYLEPROOF_FREEZE_SPEC_CLOCK=1` for the Playwright run * it spawns. Importing this module — a side effect of importing `styleproof`, * which a capture spec does before evaluating its own constants — then swaps * `globalThis.Date` for a frozen twin: zero-argument construction, `Date.now()`, * and bare `Date()` calls report `STYLEPROOF_CLOCK_TIME` (default * `DEFAULT_CLOCK_TIME`, matching the browser freeze), while explicit-argument * construction, `Date.parse`/`Date.UTC`, and every instance method behave * normally. StyleProof's own elapsed-time bookkeeping (settle windows, popup * deadlines, manifest stamps) reads `realNow()`, captured before the swap. * * Opt out with `STYLEPROOF_FREEZE_SPEC_CLOCK=0` on the capture command; * `freezeClock: false` in the spec also restores the real clock at define time. */ /** The default frozen instant, shared with the browser-side freeze (`DefineOptions.clockTime`). */ export declare const DEFAULT_CLOCK_TIME = "2025-01-01T00:00:00Z"; /** Wall-clock milliseconds from the real clock, immune to the spec-clock freeze. */ export declare function realNow(): number; /** * Resolve whether (and at what instant) the spec-process clock should freeze: * `undefined` unless `STYLEPROOF_FREEZE_SPEC_CLOCK=1`; the instant comes from * `STYLEPROOF_CLOCK_TIME` (ISO string or epoch milliseconds), defaulting to * `DEFAULT_CLOCK_TIME`. An unparseable instant throws — a silently-ignored typo * would run the capture on the live clock while claiming determinism. */ export declare function resolveSpecClockFreeze(env?: NodeJS.ProcessEnv): number | undefined; /** * Swap `globalThis.Date` for a pinned twin. A Proxy over the real constructor, * so `Date.parse`/`Date.UTC`, the prototype, and `instanceof` all keep working. * * Two deliberately different behaviours: * - **Identity values stay frozen**: zero-argument `new Date()` and bare * `Date()` report exactly `fixedMilliseconds` — module-level fixture * constants (`new Date().toISOString()`) are byte-identical across runs, * which is the phantom-diff class this freeze exists to kill. * - **`Date.now()` advances monotonically from the frozen origin** * (`fixedMilliseconds + elapsed real ms`). `now()` is the universal idiom for * deadlines and elapsed-time budgets — in consumer `--setup` helpers and in * Playwright's own bundled retry loops — and a `now()` that never moves turns * every such bound into an infinite spin (a surface "timeout" the tool itself * caused, or a hung capture). Values derived from `now()` are still pinned to * the frozen EPOCH, so date/hour-level rendering stays stable across runs. */ export declare function installFrozenSpecClock(fixedMilliseconds: number): void; /** Put the real `Date` back (the `freezeClock: false` opt-out path). */ export declare function restoreRealSpecClock(): void; /** The instant the spec-process clock is currently frozen to, if it is. */ export declare function frozenSpecClockInstant(): number | undefined;