Skip to content

Commit 6ac5eaa

Browse files
committed
Better table formatting
1 parent e10c993 commit 6ac5eaa

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

lib/ci/ci_result_parser.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ class Job {
125125
return `https://${CI_DOMAIN}/${path}console`;
126126
}
127127

128-
async getBuildData() {
128+
async getBuildData(type = 'Build') {
129129
const { cli, path } = this;
130130
cli.startSpinner(`Querying data for ${path}`);
131131
const data = await this.getAPIData();
132-
cli.stopSpinner('Build data downloaded');
132+
cli.stopSpinner(`${type} data downloaded`);
133133
return data;
134134
}
135135

@@ -763,7 +763,7 @@ class CITGMBuild extends TestBuild {
763763
async getResults() {
764764
let headerData;
765765
try {
766-
headerData = await this.getBuildData();
766+
headerData = await this.getBuildData('Header');
767767
} catch (err) {
768768
this.failures = [
769769
new NCUFailure({ url: this.apiUrl }, err.message)
@@ -778,7 +778,7 @@ class CITGMBuild extends TestBuild {
778778

779779
let resultData;
780780
try {
781-
resultData = await this.getBuildData();
781+
resultData = await this.getBuildData('Report');
782782
} catch (err) {
783783
this.failures = [
784784
new NCUFailure({ url: this.apiUrl }, err.message)
@@ -818,17 +818,14 @@ class CITGMBuild extends TestBuild {
818818
const { cli, results } = this;
819819

820820
cli.separator('Failures');
821+
const output = {};
821822
for (const failure of results.failures) {
822823
const platform = Object.keys(failure)[0];
823824
const modules = failure[platform].map(f => f.name);
824-
825-
cli.table(platform, `${modules.length} Failures`, 25);
826-
cli.write('\n');
827-
cli.table(' '.repeat(11), modules.join('\n' + ' '.repeat(11)));
828-
cli.write('\n\n');
825+
output[platform] = modules;
829826
}
830827

831-
// TODO(codebytere): how to display other builds?
828+
console.table(output);
832829
}
833830

834831
updateAPIVariables() {
@@ -840,10 +837,6 @@ class CITGMBuild extends TestBuild {
840837
this.displayHeader();
841838
this.displayBuilds();
842839
}
843-
844-
formatAsMarkdown() {
845-
// TODO(codebytere): implement.
846-
}
847840
}
848841

849842
function filterBuild(builds, type) {

0 commit comments

Comments
 (0)