fix(cli): align video output boundaries (#2490)

* fix(cli): align video output boundaries

* test(cli): honor CI ffmpeg fixture path

* test(cli): decouple duration precedence from ffmpeg

* test(cli): pin half-open video boundaries

* test(producer): refresh style 7 boundary golden
This commit is contained in:
Miguel Ángel
2026-07-15 16:07:44 -04:00
committed by GitHub
parent f45f762473
commit 35e623b4f3
7 changed files with 107 additions and 9 deletions
+25 -1
View File
@@ -4,7 +4,11 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { applyResolutionPreset, injectTailwindBrowserScript } from "./init.js";
import {
applyResolutionPreset,
injectTailwindBrowserScript,
resolveVideoDurationSeconds,
} from "./init.js";
const cliEntry = resolve(fileURLToPath(import.meta.url), "..", "..", "cli.ts");
const tailwindScript =
@@ -177,6 +181,26 @@ describe("hyperframes init flag rename", () => {
}
});
it("uses the video stream duration when audio outlasts the final video frame", () => {
expect(
resolveVideoDurationSeconds({
streamDuration: 1,
frameDuration: 1,
formatDuration: 1.2,
}),
).toBe(1);
});
it("falls through unusable stream durations before using the container duration", () => {
expect(
resolveVideoDurationSeconds({
streamDuration: 0,
frameDuration: Number.NaN,
formatDuration: 1.2,
}),
).toBe(1.2);
});
it("--audio with a missing file fails without creating the project directory", () => {
const dir = mkdtempSync(join(tmpdir(), "hf-init-test-"));
const target = join(dir, "proj");