(files: Record<string, string>)
| 19 | function writeFile(root: string, relPath: string, content: string): void { |
| 20 | const filePath = path.join(root, relPath); |
| 21 | fs.mkdirSync(path.dirname(filePath), { recursive: true }); |
| 22 | fs.writeFileSync(filePath, content, 'utf-8'); |
| 23 | } |
| 24 | |
| 25 | function createRepo(files: Record<string, string>): TestRepo { |
| 26 | const root = fs.mkdtempSync(path.join(os.tmpdir(), 'env-sync-plan-')); |
| 27 | for (const [relPath, content] of Object.entries(files)) { |
| 28 | writeFile(root, relPath, content); |
| 29 | } |
| 30 | return { |
| 31 | root, |
| 32 | cleanup: () => fs.rmSync(root, { recursive: true, force: true }), |
| 33 | }; |
no test coverage detected