Skip to content

Commit

Permalink
fix: wait for reports to be written before returning
Browse files Browse the repository at this point in the history
Use Promise.all() to wait for all reports to be written
before actually returning the main ace() function.
  • Loading branch information
rdeltour committed Sep 28, 2017
1 parent 8591a08 commit bd7d6cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ module.exports = function ace(epubPath, options) {
if (options.outdir === undefined) {
winston.info(JSON.stringify(report.getJsonReport(), null, ' '));
} else {
report.copyData(options.outdir);
report.saveJson(options.outdir);
report.saveHtml(options.outdir);
return Promise.all([
report.copyData(options.outdir),
report.saveJson(options.outdir),
report.saveHtml(options.outdir),
]);
}
})
.then(() => {
Expand Down

0 comments on commit bd7d6cb

Please sign in to comment.