(mode: 'walk' | 'git', gitignore: string, files: string[])
| 26 | }); |
| 27 | |
| 28 | function project(mode: 'walk' | 'git', gitignore: string, files: string[]): string { |
| 29 | const root = fs.mkdtempSync(path.join(os.tmpdir(), `cg-gitignore-parity-${mode}-`)); |
| 30 | roots.push(root); |
| 31 | for (const file of files) { |
| 32 | fs.mkdirSync(path.dirname(path.join(root, file)), { recursive: true }); |
| 33 | fs.writeFileSync(path.join(root, file), 'export const value = 1;\n'); |
| 34 | } |
| 35 | fs.writeFileSync(path.join(root, '.gitignore'), gitignore); |
| 36 | if (mode === 'git') execFileSync('git', ['init', '-q'], { cwd: root, stdio: 'ignore' }); |
| 37 | return root; |
| 38 | } |
| 39 | |
| 40 | function scanned(root: string): string[] { |
| 41 | return scanDirectory(root).map((f) => f.replace(/\\/g, '/')).sort(); |
no test coverage detected