Skip to content

Commit aeb17fe

Browse files
committed
1.2.2
- fixes a bug where coverage.get would kill the entire server
1 parent 38eb1fa commit aeb17fe

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.2.2 (10/29/2017)
2+
3+
- fixes a bug where coverage.get would kill the entire server
4+
15
# 1.2.1 (10/28/2017)
26

37
- adds a feed of most recent coverage updates

dist/bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/coverage.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ module.exports.get = function get(repo, limit) {
180180
Coverage.aggregate(options, (err, docs) => {
181181
if(err) { return reject(err); }
182182
// this might happen if the data is malformed
183-
if(docs.length > 1) {
183+
if(docs.length == 1) {
184+
docs[0].history = docs[0].history.sort((a, b) => {
185+
return moment(a['run_at']) - moment(b['run_at']) > 0 ? -1 : 1;
186+
});
187+
return resolve(docs);
188+
} else if(docs.length > 1){
184189
var condensed = docs[0];
185190
for(var i = 1; i < docs.length; i++) {
186191
condensed.history = condensed.history.concat(docs[i].history);
@@ -189,11 +194,9 @@ module.exports.get = function get(repo, limit) {
189194
return moment(a['run_at']) - moment(b['run_at']) > 0 ? -1 : 1;
190195
});
191196
return resolve([condensed]);
197+
} else {
198+
return reject('no coverage was found');
192199
}
193-
docs[0].history = docs[0].history.sort((a, b) => {
194-
return moment(a['run_at']) - moment(b['run_at']) > 0 ? -1 : 1;
195-
});
196-
return resolve(docs);
197200
});
198201
});
199202
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lcov-server",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "🎯 A simple lcov server & cli parser",
55
"main": "index.js",
66
"homepage": "https://github.com/gabrielcsapo/lcov-server#readme",

0 commit comments

Comments
 (0)