MCPcopy Create free account
hub / github.com/code-pushup/cli / collectPreviousReport

Function collectPreviousReport

packages/ci/src/lib/run-utils.ts:308–338  ·  view source on GitHub ↗
(
  args: BaseReportArgs,
)

Source from the content-addressed store, hash-verified

306}
307
308export 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
340export async function loadCachedBaseReport(
341 args: BaseReportArgs,

Callers 1

runOnProjectFunction · 0.85

Calls 9

loadCachedBaseReportFunction · 0.85
runInBaseBranchFunction · 0.85
configFromPatternsFunction · 0.85
checkPrintConfigFunction · 0.85
runCollectFunction · 0.85
hasDefaultPersistFormatsFunction · 0.85
saveReportFilesFunction · 0.85
persistedFilesFromConfigFunction · 0.85
logDebugFunction · 0.85

Tested by

no test coverage detected