@competent-devs/test-forge
Version:
Package for UI unit test generation based on storybook context
34 lines (28 loc) • 877 B
text/typescript
import { findUp } from "find-up";
import * as path from "node:path";
import * as fs from "node:fs/promises";
import { ModelList } from "../constants/model-list.js";
let JSONConfig: any = undefined;
export const getConfig = async () => {
const configFilePath = await findUp(".testforge");
if (JSONConfig) {
return JSONConfig;
} else {
try {
const data = await fs.readFile(
path.join(configFilePath as string, ""),
"utf8",
); // Read file as text
JSONConfig = JSON.parse(data); // Parse text to JSON
return JSONConfig;
} catch (err) {
console.error(
"config file '.testforge' was not found. Add this config file to root of your project ",
err,
);
return null;
}
}
};
export const DEPLOYMENT = ModelList.GPT_4O_MINI_2024_07_18;
export const API_VERSION = "2024-07-01-preview";