(fileName: string, regEx: RegExp | string)
| 106 | } |
| 107 | |
| 108 | export async function expectFileToMatch(fileName: string, regEx: RegExp | string): Promise<void> { |
| 109 | const content = await readFile(fileName); |
| 110 | |
| 111 | const found = typeof regEx === 'string' ? content.includes(regEx) : content.match(regEx); |
| 112 | |
| 113 | if (!found) { |
| 114 | throw new Error( |
| 115 | `File "${fileName}" did not contain "${regEx}"...\nContent:\n${content}\n------`, |
| 116 | ); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | export async function getFileSize(fileName: string) { |
| 121 | const stats = await fs.stat(fileName); |
no test coverage detected