Skip to content

Commit

Permalink
Fixed issue #35
Browse files Browse the repository at this point in the history
  • Loading branch information
nbhoski committed Jul 9, 2024
1 parent fabba39 commit 2fe0f04
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions src/buildSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@ export function getBuildSummaryTable(tasks: Task[]): string[][] {
const header: string[] = ['MATLAB Build Task', 'Status', 'Description', 'Duration (HH:MM:SS)'];
let taskSummaryTableRows: string[][] = [header];

tasks.forEach((task, index) => {
let taskDetails: string[] = [];
taskDetails.push(task.name);
if (task.failed) {
taskDetails.push('🔴 FAILED');
} else if (task.skipped) {
taskDetails.push('🔵 SKIPPED');
} else {
taskDetails.push('🟢 SUCCESS');
}
taskDetails.push(task.description);
taskDetails.push(task.duration);

taskSummaryTableRows.push(taskDetails);
});
if(!Array.isArray(tasks)){
taskSummaryTableRows = getTaskSummaryRows(tasks, taskSummaryTableRows);
} else {
tasks.forEach((task, index) => {
taskSummaryTableRows = getTaskSummaryRows(task, taskSummaryTableRows);
});
}

return taskSummaryTableRows;
}
Expand Down Expand Up @@ -61,3 +53,24 @@ export function processAndDisplayBuildSummary() {
writeSummary(taskSummaryTableRows);
}

export function addTasks(tasks: Task): string[] {
let taskDetails: string[] = [];
taskDetails.push(tasks.name);
if (tasks.failed) {
taskDetails.push('🔴 FAILED');
} else if (tasks.skipped) {
taskDetails.push('🔵 SKIPPED');
} else {
taskDetails.push('🟢 SUCCESS');
}
taskDetails.push(tasks.description);
taskDetails.push(tasks.duration);
return taskDetails;
}

export function getTaskSummaryRows(task: Task, taskSummaryTableRows: string[][]): string[][] {
let taskDetails: string[] = [];
taskDetails = addTasks(task);
taskSummaryTableRows.push(taskDetails);
return taskSummaryTableRows;
}

0 comments on commit 2fe0f04

Please sign in to comment.