(files: Record<string, string>)
| 16 | }); |
| 17 | |
| 18 | async function setupWorkDir(files: Record<string, string>): Promise<string> { |
| 19 | workDir = path.join( |
| 20 | tmpdir(), |
| 21 | `cron-detect-test-${Date.now()}-${Math.random().toString(36).slice(2)}` |
| 22 | ); |
| 23 | await fs.mkdirp(workDir); |
| 24 | for (const [filePath, content] of Object.entries(files)) { |
| 25 | const fullPath = path.join(workDir, filePath); |
| 26 | await fs.mkdirp(path.dirname(fullPath)); |
| 27 | await fs.writeFile(fullPath, content); |
| 28 | } |
| 29 | return workDir; |
| 30 | } |
| 31 | |
| 32 | it('detects a single cron entry', async () => { |
| 33 | await setupWorkDir({ |
no test coverage detected