(reportPath: string, content: string)
| 64 | } |
| 65 | |
| 66 | function persistResult(reportPath: string, content: string): Promise<FileSize> { |
| 67 | return ( |
| 68 | writeFile(reportPath, content) |
| 69 | // return reportPath instead of void |
| 70 | .then(() => stat(reportPath)) |
| 71 | .then((stats): FileSize => ({ file: reportPath, size: stats.size })) |
| 72 | .catch((error: unknown) => { |
| 73 | throw new Error( |
| 74 | `Failed to save report in ${ansis.bold(reportPath)} - ${stringifyError(error)}`, |
| 75 | ); |
| 76 | }) |
| 77 | ); |
| 78 | } |
| 79 | |
| 80 | export function logPersistedReport(reportFiles: FileSize[]) { |
| 81 | logger.info(`Persisted report to file system:`); |
no test coverage detected