11// fallow-ignore-file code-duplication
22import { EventEmitter } from "events" ;
33import { readFileSync } from "fs" ;
4- import { resolve } from "path" ;
4+ import { basename , resolve } from "path" ;
55import { afterEach , describe , expect , it , vi } from "vitest" ;
66import { extractMediaMetadata , extractPngMetadataFromBuffer } from "./ffprobe.js" ;
77
@@ -209,7 +209,7 @@ describe("ffprobe missing-binary fallback", () => {
209209 const meta = await extractMediaMetadataMocked ( fixture ) ;
210210
211211 expect ( calls . length ) . toBe ( 1 ) ;
212- expect ( calls [ 0 ] ?. command ) . toBe ( " ffprobe" ) ;
212+ expect ( basename ( calls [ 0 ] ?. command ?? "" ) ) . toMatch ( / ^ f f p r o b e (?: \. e x e ) ? $ / ) ;
213213 expect ( meta . videoCodec ) . toBe ( "png" ) ;
214214 expect ( meta . durationSeconds ) . toBe ( 0 ) ;
215215 expect ( meta . fps ) . toBe ( 0 ) ;
@@ -313,7 +313,7 @@ describe("ffprobe missing-binary fallback", () => {
313313 / f f p r o b e n o t f o u n d / ,
314314 ) ;
315315 expect ( calls . length ) . toBe ( 1 ) ;
316- expect ( calls [ 0 ] ?. command ) . toBe ( " ffprobe" ) ;
316+ expect ( basename ( calls [ 0 ] ?. command ?? "" ) ) . toMatch ( / ^ f f p r o b e (?: \. e x e ) ? $ / ) ;
317317 } ) ;
318318
319319 it ( "analyzeKeyframeIntervals surfaces a ffprobe-missing error verbatim" , async ( ) => {
@@ -327,7 +327,7 @@ describe("ffprobe missing-binary fallback", () => {
327327 / f f p r o b e n o t f o u n d / ,
328328 ) ;
329329 expect ( calls . length ) . toBe ( 1 ) ;
330- expect ( calls [ 0 ] ?. command ) . toBe ( " ffprobe" ) ;
330+ expect ( basename ( calls [ 0 ] ?. command ?? "" ) ) . toMatch ( / ^ f f p r o b e (?: \. e x e ) ? $ / ) ;
331331 } ) ;
332332
333333 it ( "ffprobe-missing error message includes install hint" , async ( ) => {
0 commit comments