mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 12:28:12 +00:00
fix(cli): prefer real ffmpeg exe over cmd shim (#1958)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("node:child_process", () => ({ execSync: vi.fn() }));
|
||||
@@ -23,6 +24,14 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("findFFmpeg", () => {
|
||||
it("prefers the real Windows exe when where lists a cmd shim first", async () => {
|
||||
Object.defineProperty(process, "platform", { value: "win32", configurable: true });
|
||||
mockExec.mockReturnValue("C:\\tools\\ffmpeg.cmd\r\nC:\\tools\\ffmpeg.exe\r\n");
|
||||
|
||||
const { findFFmpeg } = await import("./ffmpeg.js");
|
||||
expect(findFFmpeg()).toBe(resolve("C:\\tools\\ffmpeg.exe"));
|
||||
});
|
||||
|
||||
it("falls back to a common install dir when `which` fails (GUI-launched PATH)", async () => {
|
||||
// Simulate a process whose PATH lacks /opt/homebrew/bin: `which ffmpeg` throws.
|
||||
mockExec.mockImplementation(() => {
|
||||
|
||||
Reference in New Issue
Block a user