diff --git a/packages/cli/src/utils/checkBrowser.test.ts b/packages/cli/src/utils/checkBrowser.test.ts index d5113042b0..727e691d11 100644 --- a/packages/cli/src/utils/checkBrowser.test.ts +++ b/packages/cli/src/utils/checkBrowser.test.ts @@ -1502,7 +1502,7 @@ describe("preResolveHostileMediaProxies", () => { await pending; expect(errorSpy.mock.calls.map(([line]) => line)).toContain( - "[hyperframes] browser-playable copy of clip.mov: 25% (10s so far)", + "[hyperframes] making browser-playable copies: 0 of 1 done. clip.mov: 25% (10s so far)", ); } finally { mocks.proxyProgress.feed = undefined; @@ -1540,8 +1540,10 @@ describe("preResolveHostileMediaProxies", () => { await pending; const lines = errorSpy.mock.calls.map(([line]) => String(line)); - expect(lines).toContain("[hyperframes] browser-playable copy of b.mov: 25% (10s so far)"); - expect(lines.some((line) => line.includes("copy of a.mov"))).toBe(false); + expect(lines).toContain( + "[hyperframes] making browser-playable copies: 1 of 2 done. b.mov: 25% (10s so far)", + ); + expect(lines.some((line) => line.includes(" a.mov: "))).toBe(false); } finally { mocks.proxyProgress.feed = undefined; vi.useRealTimers(); diff --git a/packages/cli/src/utils/checkBrowser.ts b/packages/cli/src/utils/checkBrowser.ts index d844f39e0e..924a976c8e 100644 --- a/packages/cli/src/utils/checkBrowser.ts +++ b/packages/cli/src/utils/checkBrowser.ts @@ -165,6 +165,8 @@ function startCopyHeartbeat( } { const startedAt = Date.now(); const latest = new Map(); + const total = cached.filter((isCached) => !isCached).length; + let finished = 0; const timer = setInterval(() => { for (const [index, { doneSeconds, totalSeconds }] of latest) { if (cached[index]) continue; @@ -172,14 +174,17 @@ function startCopyHeartbeat( ? `${Math.min(100, Math.floor((doneSeconds / totalSeconds) * 100))}%` : ""; console.error( - `[hyperframes] browser-playable copy of ${sources[index]!.file}: ${done || `${Math.floor(doneSeconds)}s done`} (${elapsedText(Date.now() - startedAt)} so far)`, + `[hyperframes] making browser-playable copies: ${finished} of ${total} done. ${sources[index]!.file}: ${done || `${Math.floor(doneSeconds)}s done`} (${elapsedText(Date.now() - startedAt)} so far)`, ); } }, COPY_HEARTBEAT_MS); timer.unref(); return { progress: (index, progress) => void latest.set(index, progress), - settled: (index) => void latest.delete(index), + settled: (index) => { + latest.delete(index); + if (!cached[index]) finished += 1; + }, stop: () => clearInterval(timer), }; }