Skip to content

Commit 23f3f14

Browse files
committed
Fixing the report generation code
1 parent 6d9848f commit 23f3f14

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

bin/commands/runs.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const archiver = require("../helpers/archiver"),
99
utils = require("../helpers/utils"),
1010
fileHelpers = require("../helpers/fileHelpers"),
1111
syncRunner = require("../helpers/syncRunner"),
12-
reporterHTML = require('../helpers/reporterHTML');
12+
reportGenerator = require('../helpers/reporterHTML').reportGenerator;
1313

1414
module.exports = function run(args) {
1515
let bsConfigPath = utils.getConfigPath(args.cf);
@@ -71,10 +71,11 @@ module.exports = function run(args) {
7171
}
7272
if (args.sync) {
7373
syncRunner.pollBuildStatus(bsConfig, data).then((exitCode) => {
74-
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null);
7574
// Generate custom report!
76-
reporterHTML.reportGenerator(bsConfig, data.build_id, args);
77-
utils.handleSyncExit(exitCode, data.dashboard_url)
75+
reportGenerator(bsConfig, data.build_id, args, function(){
76+
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null);
77+
utils.handleSyncExit(exitCode, data.dashboard_url);
78+
});
7879
});
7980
}
8081

bin/helpers/reporterHTML.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function buildSpecStats(specMeta) {
8888
return specStats;
8989
}
9090

91-
let reportGenerator = (bsConfig, buildId, args) => {
91+
let reportGenerator = (bsConfig, buildId, args, cb) => {
9292
let options = {
9393
url: `${config.buildUrl}${buildId}/custom_report`,
9494
auth: {
@@ -100,7 +100,7 @@ let reportGenerator = (bsConfig, buildId, args) => {
100100
},
101101
};
102102

103-
request.get(options, function (err, resp, body) {
103+
return request.get(options, function (err, resp, body) {
104104
let message = null;
105105
let messageType = null;
106106
let errorCode = null;
@@ -152,8 +152,10 @@ let reportGenerator = (bsConfig, buildId, args) => {
152152
logger.info(message);
153153
}
154154
utils.sendUsageReport(bsConfig, args, message, messageType, errorCode);
155+
if (cb){
156+
cb();
157+
}
155158
});
156-
157159
}
158160

159161
function renderReportHTML(report_data) {

0 commit comments

Comments
 (0)