()
| 18 | const tmpdir = process.env['TEST_TMPDIR']!; |
| 19 | |
| 20 | export function makeTempDir(): string { |
| 21 | let dir: string; |
| 22 | while (true) { |
| 23 | const id = (Math.random() * 1000000).toFixed(0); |
| 24 | dir = path.posix.join(tmpdir, `tmp.${id}`); |
| 25 | if (!fs.existsSync(dir)) break; |
| 26 | } |
| 27 | fs.mkdirSync(dir); |
| 28 | return dir; |
| 29 | } |
| 30 | |
| 31 | export interface TestSupport { |
| 32 | basePath: string; |