(callback: (root: string) => Promise<T>)
| 7 | import { generate, generateCatalog } from "../src/index.js"; |
| 8 | |
| 9 | async function withFixture<T>(callback: (root: string) => Promise<T>) { |
| 10 | const root = await mkdtemp(path.join(tmpdir(), "models-dev-test-")); |
| 11 | try { |
| 12 | return await callback(root); |
| 13 | } finally { |
| 14 | await rm(root, { recursive: true, force: true }); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | async function write(root: string, file: string, content: string) { |
| 19 | const filePath = path.join(root, file); |