mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
test(producer): make path contracts portable on Windows (#5032)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { existsSync } from "node:fs";
|
||||
|
||||
@@ -33,7 +33,7 @@ describe("resolveHyperframeManifestPath", () => {
|
||||
// dist/index.js. In source, SIBLING_MANIFEST_PATH is next to this file.
|
||||
// This verifies the path construction is correct.
|
||||
expect(SIBLING_PATH).toBe(resolve(THIS_DIR, "hyperframe.manifest.json"));
|
||||
expect(SIBLING_PATH).toContain("producer/src/services/hyperframe.manifest.json");
|
||||
expect(SIBLING_PATH).toContain(join("producer", "src", "services", "hyperframe.manifest.json"));
|
||||
});
|
||||
|
||||
it("prefers sibling path when it exists, otherwise picks the first existing candidate", async () => {
|
||||
|
||||
@@ -135,7 +135,7 @@ describe("manifest io", () => {
|
||||
|
||||
it("segmentDirFor nests under renders/.hf-segments", () => {
|
||||
dir = mkdtempSync(join(tmpdir(), "hf-seg-"));
|
||||
expect(segmentDirFor("/p/renders", "abc")).toBe("/p/renders/.hf-segments/abc");
|
||||
expect(segmentDirFor("/p/renders", "abc")).toBe(join("/p/renders", ".hf-segments", "abc"));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -158,16 +158,17 @@ function discoverCallers(): { found: string[]; unclassified: string[]; shell: st
|
||||
const shell: string[] = [];
|
||||
const classify = (abs: string): void => {
|
||||
const src = readFileSync(abs, "utf8");
|
||||
const relPath = relative(REPO_ROOT, abs).replaceAll("\\", "/");
|
||||
if (SHELL_EXT.test(abs) && SHELL_PROBE_CALL.test(src)) {
|
||||
shell.push(relative(REPO_ROOT, abs));
|
||||
shell.push(relPath);
|
||||
}
|
||||
// Discovery is ARGV-shaped, not call-shaped. Matching on spawn/execFile
|
||||
// misses a dependency-injected runner — `runner("ffprobe", [...])` in
|
||||
// studio-server's mediaValidation.ts is exactly that, and a call-shaped
|
||||
// predicate skipped it silently. Anything that BUILDS a probe argv is a
|
||||
// caller, however it is invoked.
|
||||
if (argvTails(src).length > 0) found.push(relative(REPO_ROOT, abs));
|
||||
else if (mentionsProbe(src)) unclassified.push(relative(REPO_ROOT, abs));
|
||||
if (argvTails(src).length > 0) found.push(relPath);
|
||||
else if (mentionsProbe(src)) unclassified.push(relPath);
|
||||
};
|
||||
const walk = (dir: string): void => {
|
||||
for (const entry of readdirSync(dir)) {
|
||||
|
||||
Reference in New Issue
Block a user