test: extract ExecFileFn type to separate file to make it reusable

This commit is contained in:
Jörg Krzeslak
2025-07-24 10:42:36 +02:00
parent 2db99edeaf
commit 2c90454244
2 changed files with 7 additions and 7 deletions

View File

@@ -1,10 +1,5 @@
import { execFile as execFileOriginal } from "node:child_process";
export type ExecFileFn = (
cmd: string,
args: string[],
callback: (err: Error | null, stdout: string, stderr: string) => void,
) => void;
import { ExecFileFn } from "./types.ts";
export const properties = {
from: {
@@ -123,7 +118,7 @@ export async function convert(
convertTo: string,
targetPath: string,
options?: unknown,
execFile: ExecFileFn = execFileOriginal,
execFile: ExecFileFn = execFileOriginal, // to make it mockable
): Promise<string> {
return new Promise((resolve, reject) => {
execFile("assimp", ["export", filePath, targetPath], (error, stdout, stderr) => {

5
src/converters/types.ts Normal file
View File

@@ -0,0 +1,5 @@
export type ExecFileFn = (
cmd: string,
args: string[],
callback: (err: Error | null, stdout: string, stderr: string) => void,
) => void;