Skip to content

Commit

Permalink
fix: do not fail if one of the reports is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
eGavr committed Feb 12, 2019
1 parent aa72ac1 commit a962f1d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 72 deletions.
5 changes: 4 additions & 1 deletion lib/merge-reports/data-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ const {isSkippedStatus} = require('../common-utils');
const {findNode, setStatusForBranch} = require('../static/modules/utils');
const {getDataFrom, getStatNameForStatus, getImagePaths} = require('./utils');

const defaults = (data) => _.defaults(data, {suites: [], skips: [], config: {}});

module.exports = class DataTree {
static create(initialData, destPath) {
return new DataTree(initialData, destPath);
}

constructor(initialData, destPath) {
this._data = initialData;
this._data = defaults(initialData);
this._destPath = destPath;
}

async mergeWith(dataCollection) {
// make it serially in order to perform correct merge/permutation of images and datas
await Promise.each(_.toPairs(dataCollection), async ([path, data]) => {
data = defaults(data);
this._srcPath = path;
this._mergeSkips(data.skips);

Expand Down
Loading

0 comments on commit a962f1d

Please sign in to comment.