Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(engine): lazy-promisify execFile in psnr so partial child_process mocks don't crash at import
Vance Ingalls4889b779c90f
diff --git a/packages/cli/src/commands/render.test.ts b/packages/cli/src/commands/render.test.tsindex 48f0ce7c20..e3a1fdabed 100644--- a/packages/cli/src/commands/render.test.ts+++ b/packages/cli/src/commands/render.test.ts@@ -123,6 +123,20 @@ vi.mock("../telemetry/config.js", () => ({configState.cache = { ...configState.disk };return { ...configState.disk };}),+ recordRecentRender: vi.fn((id: string, ok: boolean) => {+ // Mirrors the real ring update (readConfigFresh → append, cap 5 → write)+ // against the mock's disk state, so a render's recent-renders write is+ // modeled like every other config mutation here. Fixed timestamp keeps it+ // deterministic (tests never assert on `at`).+ const disk = configState.disk as Record<string, unknown>;+ const ring = [+ ...((disk.recentRenders as unknown[]) ?? []),+ { id, at: "2026-01-01T00:00:00Z", ok },+ ];+ const next = { ...disk, recentRenders: ring.slice(-5) };+ configState.disk = next;+ configState.cache = { ...next };+ }),writeConfig: vi.fn((config: Record<string, unknown>) => {configState.writeConfigCalls.push({ ...config });if (configState.failWrites > 0) {diff --git a/packages/engine/src/utils/psnr.ts b/packages/engine/src/utils/psnr.tsindex 4d92ac110b..675594ec47 100644--- a/packages/engine/src/utils/psnr.ts+++ b/packages/engine/src/utils/psnr.ts@@ -5,14 +5,17 @@ import { join } from "node:path";import { promisify } from "node:util";import { getFfmpegBinary } from "./ffmpegBinaries.js";-const execFileP = promisify(execFile);-/*** PSNR (average, dB) between two same-dimension encoded images via ffmpeg.* Infinity means bit-identical pixels. Single source of truth for every* drawElement self-verify comparison (streaming drain + parallel disk path).*/export async function psnrDb(a: Buffer, b: Buffer): Promise<number> {+ // promisify(execFile) lazily, not at module load: this module is in the+ // engine's parallel-capture import chain, and a top-level call to a builtin+ // crashes any downstream test that partially mocks node:child_process+ // without an execFile export (vitest surfaces it as a load-time error).+ const execFileP = promisify(execFile);const dir = await mkdtemp(join(tmpdir(), "hf-de-verify-"));try {const pa = join(dir, "a.jpg");