(dir: string, regex: RegExp)
| 77 | } |
| 78 | |
| 79 | export async function expectFileMatchToExist(dir: string, regex: RegExp): Promise<string> { |
| 80 | const files = await fs.readdir(dir); |
| 81 | const fileName = files.find((name) => regex.test(name)); |
| 82 | |
| 83 | if (!fileName) { |
| 84 | throw new Error(`File ${regex} was expected to exist but not found...`); |
| 85 | } |
| 86 | |
| 87 | return fileName; |
| 88 | } |
| 89 | |
| 90 | export async function expectFileNotToExist(fileName: string): Promise<void> { |
| 91 | try { |
no test coverage detected