Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(engine): make urlDownloader retry tests independent of wall-clock time (#4155)
Miguel Ángel607775bb3aa4
diff --git a/packages/engine/src/utils/urlDownloader.test.ts b/packages/engine/src/utils/urlDownloader.test.tsindex 8aecb893a7..c2c1324eee 100644--- a/packages/engine/src/utils/urlDownloader.test.ts+++ b/packages/engine/src/utils/urlDownloader.test.ts@@ -1,5 +1,5 @@// fallow-ignore-file code-duplication-import { afterEach, describe, expect, it, vi } from "vitest";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import {existsSync,mkdirSync,@@ -112,7 +112,15 @@ function isoBmffMediaBytes(marker: string): Buffer {return Buffer.concat([ftyp, Buffer.from(marker)]);}+// Fake only Date: downloadToTemp's deadlines read Date.now() around sync work, so a slow+// runner can trip a false timeout with no timer-driven delay. Real timers keep firing, so+// setTimeout-based races are unaffected.+beforeEach(() => {+ vi.useFakeTimers({ toFake: ["Date"] });+});+afterEach(() => {+ vi.useRealTimers();vi.unstubAllGlobals();fsRaceControls.deleteBeforeLstatPath = undefined;fsRaceControls.deleteInjectedWinnerBeforeLstatPath = undefined;