mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-12 07:09:59 +00:00
fix(engine): lazy-promisify execFile in psnr so partial child_process mocks don't crash at import
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user