Skip to content

Commit

Permalink
fix(core): restore failed project summary data to dynamic output (#9632)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed Mar 31, 2022
1 parent 6d0f271 commit 72c0a5b
Showing 1 changed file with 46 additions and 23 deletions.
Expand Up @@ -66,6 +66,7 @@ export async function createRunManyDynamicOutputRenderer({
};
});

const failedTasks = new Set();
const tasksToTerminalOutputs: Record<string, string> = {};
const tasksToProcessStartTimes: Record<
string,
Expand Down Expand Up @@ -231,14 +232,6 @@ export async function createRunManyDynamicOutputRenderer({
additionalFooterRows.push('');
}

if (totalFailedTasks > 0) {
additionalFooterRows.push(
` ${output.colors.red(
figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`
);
}

if (totalSuccessfulTasks > 0) {
additionalFooterRows.push(
` ${output.colors.green(
Expand All @@ -249,6 +242,14 @@ export async function createRunManyDynamicOutputRenderer({
);
}

if (totalFailedTasks > 0) {
additionalFooterRows.push(
` ${output.colors.red(
figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`
);
}

clearPinnedFooter();

if (additionalFooterRows.length > 1) {
Expand Down Expand Up @@ -376,25 +377,46 @@ export async function createRunManyDynamicOutputRenderer({
.forEach((arg) => taskOverridesRows.push(arg));
}

renderPinnedFooter(
[
output.applyNxPrefix(
'red',
output.colors.red(text) + output.dim.white(` (${timeTakenText})`)
),
...taskOverridesRows,
'',
` ${output.colors.red(
figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
const numFailedToPrint = 5;
const failedTasksForPrinting = Array.from(failedTasks).slice(
0,
numFailedToPrint
);
const failureSummaryRows = [
output.applyNxPrefix(
'red',
output.colors.red(text) + output.dim.white(` (${timeTakenText})`)
),
...taskOverridesRows,
'',
output.dim(
` ${output.dim(
figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim(
`[${totalCachedTasks} read from cache]`
)}`,
],
'red'
);
)}`
),
'',
` ${output.colors.red(
figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
`${failedTasksForPrinting
.map(
(t) =>
` ${output.colors.red('-')} ${output.dim('nx run')} ${t}`
)
.join('\n ')}`,
];

if (failedTasks.size > numFailedToPrint) {
failureSummaryRows.push(
output.dim(
` ...and ${failedTasks.size - numFailedToPrint} more...`
)
);
}

renderPinnedFooter(failureSummaryRows, 'red');
}
resolveRenderIsDonePromise();
};
Expand Down Expand Up @@ -443,6 +465,7 @@ export async function createRunManyDynamicOutputRenderer({
break;
case 'failure':
totalFailedTasks++;
failedTasks.add(t.task.id);
break;
}
printTaskResult(t.task, t.status);
Expand Down

0 comments on commit 72c0a5b

Please sign in to comment.