UNPKG

@competent-devs/test-forge

Version:

Package for UI unit test generation based on storybook context

22 lines 793 B
import * as path from "node:path"; import * as fs from "node:fs/promises"; import { readCsf } from "storybook/internal/csf-tools"; const EXTENSION_MDX = ".mdx"; export async function writeTestFile(fileName, code) { console.log("Writing test file", fileName); return fs.writeFile(fileName, code, { flag: "w+" }); } export async function readTestFile(fileName) { console.log("Reading test file", fileName); return fs.readFile(fileName, "utf8"); } export async function readCsfFile(filePath) { console.log(`Reading CSF file ${filePath}`); return (await readCsf(filePath, { makeTitle: (userTitle) => userTitle || "default", })).parse(); } export function isMDX(filePath) { return path.extname(filePath) === EXTENSION_MDX; } //# sourceMappingURL=utils.js.map