Skip to content

Commit

Permalink
1.2.2
Browse files Browse the repository at this point in the history
- fixes a bug where coverage.get would kill the entire server
  • Loading branch information
gabrielcsapo committed Oct 30, 2017
1 parent 38eb1fa commit aeb17fe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.2 (10/29/2017)

- fixes a bug where coverage.get would kill the entire server

# 1.2.1 (10/28/2017)

- adds a feed of most recent coverage updates
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions lib/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ module.exports.get = function get(repo, limit) {
Coverage.aggregate(options, (err, docs) => {
if(err) { return reject(err); }
// this might happen if the data is malformed
if(docs.length > 1) {
if(docs.length == 1) {
docs[0].history = docs[0].history.sort((a, b) => {
return moment(a['run_at']) - moment(b['run_at']) > 0 ? -1 : 1;
});
return resolve(docs);
} else if(docs.length > 1){
var condensed = docs[0];
for(var i = 1; i < docs.length; i++) {
condensed.history = condensed.history.concat(docs[i].history);
Expand All @@ -189,11 +194,9 @@ module.exports.get = function get(repo, limit) {
return moment(a['run_at']) - moment(b['run_at']) > 0 ? -1 : 1;
});
return resolve([condensed]);
} else {
return reject('no coverage was found');
}
docs[0].history = docs[0].history.sort((a, b) => {
return moment(a['run_at']) - moment(b['run_at']) > 0 ? -1 : 1;
});
return resolve(docs);
});
});
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lcov-server",
"version": "1.2.1",
"version": "1.2.2",
"description": "🎯 A simple lcov server & cli parser",
"main": "index.js",
"homepage": "https://github.com/gabrielcsapo/lcov-server#readme",
Expand Down

0 comments on commit aeb17fe

Please sign in to comment.