( args: BaseReportArgs, )
| 306 | } |
| 307 | |
| 308 | export async function collectPreviousReport( |
| 309 | args: BaseReportArgs, |
| 310 | ): Promise<ReportData<'previous'> | null> { |
| 311 | const { ctx, env, base, project } = args; |
| 312 | const { settings } = env; |
| 313 | const { configPatterns } = settings; |
| 314 | |
| 315 | const cachedBaseReport = await loadCachedBaseReport(args); |
| 316 | if (cachedBaseReport) { |
| 317 | return cachedBaseReport; |
| 318 | } |
| 319 | |
| 320 | return runInBaseBranch(base, env, async () => { |
| 321 | const config = configPatterns |
| 322 | ? configFromPatterns(configPatterns, project) |
| 323 | : await checkPrintConfig(args); |
| 324 | if (!config) { |
| 325 | return null; |
| 326 | } |
| 327 | |
| 328 | await runCollect(ctx, { hasFormats: hasDefaultPersistFormats(config) }); |
| 329 | const report = await saveReportFiles({ |
| 330 | project, |
| 331 | type: 'previous', |
| 332 | files: persistedFilesFromConfig(config, ctx), |
| 333 | settings, |
| 334 | }); |
| 335 | logDebug(`Collected previous report at ${report.files.json}`); |
| 336 | return report; |
| 337 | }); |
| 338 | } |
| 339 | |
| 340 | export async function loadCachedBaseReport( |
| 341 | args: BaseReportArgs, |
no test coverage detected