Skip to content

Commit

Permalink
Merge pull request #55 from petey/lcovFormat
Browse files Browse the repository at this point in the history
Add LineHandled and LineFound output to lcov reporter
  • Loading branch information
jschilli committed May 6, 2015
2 parents ea89f8d + 76a87a1 commit 22c8dc7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/reporters/lcov-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@ var Reporter = require('../reporter');

var lcovRecord = function(data) {

var str = "";
var str = "",
lineHandled = 0,
lineFound = 0;

str += 'SF:' + data.fileName + '\n';
data.lines.forEach(function(value, num) {
if (value !== null) {
str += 'DA:' + num + ',' + value + '\n';
lineFound += 1;
if (value > 0) {
lineHandled += 1;
}
}
});

str += 'LF:' + lineFound + '\n';
str += 'LH:' + lineHandled + '\n';
str += 'end_of_record';
return str;
};
Expand Down
28 changes: 28 additions & 0 deletions tests/fixtures/lcov.dat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ DA:7,1
DA:9,1
DA:15,1
DA:17,1
LF:6
LH:6
end_of_record
SF:todomvc-ember-cli/config/environment
DA:1,1
Expand All @@ -15,6 +17,8 @@ DA:9,0
DA:10,0
DA:12,0
DA:15,0
LF:8
LH:1
end_of_record
SF:todomvc-ember-cli/initializers/app-version
DA:1,1
Expand All @@ -23,6 +27,8 @@ DA:7,1
DA:9,1
DA:12,8
DA:13,8
LF:6
LH:6
end_of_record
SF:todomvc-ember-cli/initializers/export-application-global
DA:1,1
Expand All @@ -33,6 +39,8 @@ DA:10,8
DA:12,8
DA:13,1
DA:19,1
LF:8
LH:8
end_of_record
SF:todomvc-ember-cli/router
DA:1,1
Expand All @@ -43,12 +51,16 @@ DA:12,1
DA:13,1
DA:14,1
DA:18,1
LF:8
LH:8
end_of_record
SF:todomvc-ember-cli/models/todo
DA:1,1
DA:5,1
DA:7,1
DA:12,1
LF:4
LH:4
end_of_record
SF:todomvc-ember-cli/controllers/todo
DA:1,1
Expand All @@ -69,6 +81,8 @@ DA:36,14
DA:39,0
DA:40,0
DA:41,0
LF:18
LH:15
end_of_record
SF:todomvc-ember-cli/utils/util
DA:1,1
Expand All @@ -78,6 +92,8 @@ DA:9,2
DA:11,14
DA:12,14
DA:16,1
LF:7
LH:7
end_of_record
SF:todomvc-ember-cli/controllers/todos
DA:1,1
Expand All @@ -102,12 +118,16 @@ DA:55,9
DA:57,0
DA:58,0
DA:59,0
LF:22
LH:15
end_of_record
SF:todomvc-ember-cli/routes/todos
DA:1,1
DA:5,1
DA:7,1
DA:9,4
LF:4
LH:4
end_of_record
SF:todomvc-ember-cli/routes/todos/active
DA:1,1
Expand All @@ -116,6 +136,8 @@ DA:7,1
DA:9,0
DA:10,0
DA:14,0
LF:6
LH:3
end_of_record
SF:todomvc-ember-cli/routes/todos/completed
DA:1,1
Expand All @@ -124,16 +146,22 @@ DA:7,1
DA:9,0
DA:10,0
DA:14,0
LF:6
LH:3
end_of_record
SF:todomvc-ember-cli/routes/todos/index
DA:1,1
DA:5,1
DA:7,1
DA:9,4
LF:4
LH:4
end_of_record
SF:todomvc-ember-cli/adapters/application
DA:1,1
DA:5,1
DA:7,1
DA:11,1
LF:4
LH:4
end_of_record

0 comments on commit 22c8dc7

Please sign in to comment.