Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

test: respect host paths and media tools

kashorin0dfee16c2e9d
diff --git a/packages/cli/test/control-commands.test.ts b/packages/cli/test/control-commands.test.ts
index e7e56fb3..dd4e87ee 100644
--- a/packages/cli/test/control-commands.test.ts
+++ b/packages/cli/test/control-commands.test.ts
@@ -1,4 +1,5 @@
import assert from "node:assert/strict";
+import { resolve } from "node:path";
import test from "node:test";
import type { CliDistribution } from "../src/distribution.js";
@@ -389,6 +390,7 @@ test("command options fail closed instead of being silently ignored", async () =
});
test("doctor diagnoses project Results without requiring a Runtime Profile", async () => {
+ const projectRoot = resolve("/tmp/hypit-project");
const calls: string[] = [];
const distribution = {
async diagnoseProjectResults(projectRoot: string) {
@@ -401,14 +403,14 @@ test("doctor diagnoses project Results without requiring a Runtime Profile", asy
},
} as unknown as CliDistribution;
let output = "";
- await runCli(["doctor", "--workspace", "/tmp/hypit-project", "--json"], {
+ await runCli(["doctor", "--workspace", projectRoot, "--json"], {
write(text) { output += text; },
}, distribution);
- assert.deepEqual(calls, ["results:/tmp/hypit-project"]);
+ assert.deepEqual(calls, [`results:${projectRoot}`]);
assert.deepEqual(JSON.parse(output), {
format: "hypit.cli-doctor@3",
ok: true,
- project: "/tmp/hypit-project",
+ project: projectRoot,
diagnosticCount: 0,
diagnostics: [],
});
diff --git a/packages/media-execution/test/alpha.test.ts b/packages/media-execution/test/alpha.test.ts
index 5898b57e..d8687683 100644
--- a/packages/media-execution/test/alpha.test.ts
+++ b/packages/media-execution/test/alpha.test.ts
@@ -3,12 +3,14 @@ import test from "node:test";
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
-import { MemoryResourceStore, alphaSize, ffmpegBytes, normalizeTestVideo, testMediaEnvironment, transparentVideoFixture, writeTestArtifact } from "../../../test/alpha-video-fixture.js";
+import { MemoryResourceStore, alphaSize, ffmpegBytes, hasMediaBinaries, normalizeTestVideo, testMediaEnvironment, transparentVideoFixture, writeTestArtifact } from "../../../test/alpha-video-fixture.js";
import { executeExtractFrame } from "../src/index.js";
import { canonicalize } from "@hypit/protocol";
for (const format of ["webm", "webm-vp8", "mov"] as const) {
- test(`Normalize preserves transparent and translucent pixels, motion and audio from ${format}`, async () => {
+ test(`Normalize preserves transparent and translucent pixels, motion and audio from ${format}`, {
+ skip: !hasMediaBinaries && "ffmpeg and ffprobe are not installed",
+ }, async () => {
const directory = await mkdtemp(join(tmpdir(), "hypit-alpha-normalize-"));
try {
const resources = new MemoryResourceStore();
diff --git a/test/alpha-video-fixture.ts b/test/alpha-video-fixture.ts
index 4131bc18..e421f25f 100644
--- a/test/alpha-video-fixture.ts
+++ b/test/alpha-video-fixture.ts
@@ -11,11 +11,17 @@ import { selectMediaStreams } from "@hypit/media-pipeline";
import { canonicalize } from "@hypit/protocol";
import type { BlobRef } from "@hypit/protocol";
+export const hasMediaBinaries = spawnSync("ffmpeg", ["-version"], {
+ stdio: "ignore", windowsHide: true,
+}).status === 0 && spawnSync("ffprobe", ["-version"], {
+ stdio: "ignore", windowsHide: true,
+}).status === 0;
+
export function ffmpegBytes(args: string[], input?: Uint8Array): Buffer {
const result = spawnSync("ffmpeg", ["-v", "error", "-y", ...args], {
- ...(input === undefined ? {} : { input }), maxBuffer: 16 * 1024 * 1024,
+ ...(input === undefined ? {} : { input }), maxBuffer: 16 * 1024 * 1024, windowsHide: true,
});
- assert.equal(result.status, 0, result.stderr.toString());
+ assert.equal(result.status, 0, result.stderr?.toString() ?? result.error?.message ?? "ffmpeg failed");
return result.stdout;
}