Skip to content

Commit

Permalink
log run output incrementally (#2334)
Browse files Browse the repository at this point in the history
  • Loading branch information
niclim authored Sep 25, 2023
1 parent d21c8ec commit c080ab8
Showing 1 changed file with 27 additions and 29 deletions.
56 changes: 27 additions & 29 deletions projects/optic/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,34 +225,32 @@ type SpecReport = {
};
};

function report(specReports: SpecReport[]) {
for (const report of specReports) {
logger.info(`| ${chalk.bold(report.title)} (${report.path})`);
if (report.error) {
logger.warn(`| Optic encountered an error: ${report.error}`);
return;
}
const breakingChangesReport = !report.diffs
? '☑️ No changes '
: report.breakingChanges
? `❌ ${report.breakingChanges} breaking change${
report.breakingChanges > 1 ? 's' : ''
} `
: '✅ No breaking changes ';

const designReport = report.designIssues
? `❌ ${report.designIssues} design issue${
report.designIssues > 1 ? 's' : ''
} `
: '✅ Design ';

logger.info(`| ${breakingChangesReport}${designReport}`);

if (report.changelogLink) {
logger.info(`| View report: ${report.changelogLink}`);
}
logger.info('');
function report(report: SpecReport) {
logger.info(`| ${chalk.bold(report.title)} (${report.path})`);
if (report.error) {
logger.warn(`| Optic encountered an error: ${report.error}`);
return;
}
const breakingChangesReport = !report.diffs
? '☑️ No changes '
: report.breakingChanges
? `❌ ${report.breakingChanges} breaking change${
report.breakingChanges > 1 ? 's' : ''
} `
: '✅ No breaking changes ';

const designReport = report.designIssues
? `❌ ${report.designIssues} design issue${
report.designIssues > 1 ? 's' : ''
} `
: '✅ Design ';

logger.info(`| ${breakingChangesReport}${designReport}`);

if (report.changelogLink) {
logger.info(`| View report: ${report.changelogLink}`);
}
logger.info('');
}

// Dirty dirty, lemon squeezy
Expand Down Expand Up @@ -536,9 +534,9 @@ export const getRunAction =
changelogUrl: changelogUrl ?? '',
results: specResults.results,
});
}

report(specReports);
report(specReport);
}

if (commentToken && isPR) {
const data = results.map((result) => ({
Expand Down

0 comments on commit c080ab8

Please sign in to comment.