(
files: Record<string, string> = {},
baseDir = join(tmpdir(), "plannotator-resolve-file-"),
)
| 19 | const tempDirs: string[] = []; |
| 20 | |
| 21 | function createTempProject( |
| 22 | files: Record<string, string> = {}, |
| 23 | baseDir = join(tmpdir(), "plannotator-resolve-file-"), |
| 24 | ): string { |
| 25 | const root = mkdtempSync(baseDir); |
| 26 | tempDirs.push(root); |
| 27 | for (const [relativePath, content] of Object.entries(files)) { |
| 28 | const full = join(root, relativePath); |
| 29 | mkdirSync(join(full, ".."), { recursive: true }); |
| 30 | writeFileSync(full, content); |
| 31 | } |
| 32 | return root; |
| 33 | } |
| 34 | |
| 35 | afterEach(() => { |
| 36 | for (const dir of tempDirs.splice(0)) { |
no test coverage detected