aboutsummaryrefslogtreecommitdiff
path: root/test/convertLcovToCoveralls.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/convertLcovToCoveralls.js')
-rw-r--r--test/convertLcovToCoveralls.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js
index 25a0e97..9a7789c 100644
--- a/test/convertLcovToCoveralls.js
+++ b/test/convertLcovToCoveralls.js
@@ -88,6 +88,35 @@ describe("convertLcovToCoveralls", function(){
});
});
+ it ("should handle branch coverage data", function(done){
+ process.env.TRAVIS_JOB_ID = -1;
+ var lcovpath = __dirname + "/../fixtures/istanbul.lcov";
+ var input = fs.readFileSync(lcovpath, "utf8");
+ var libpath = "/Users/deepsweet/Dropbox/projects/svgo/lib";
+ var sourcepath = path.resolve(libpath, "svgo/config.js");
+
+ var originalReadFileSync = fs.readFileSync;
+ fs.readFileSync = function(filepath) {
+ if (filepath === sourcepath) {
+ return '';
+ }
+
+ return originalReadFileSync.apply(fs, arguments);
+ };
+
+ var originalExistsSync = fs.existsSync;
+ fs.existsSync = function () { return true; };
+
+ convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){
+ fs.readFileSync = originalReadFileSync;
+ fs.existsSync = originalExistsSync;
+
+ should.not.exist(err);
+ output.source_files[0].branches.slice(0,8).should.eql([18,1,0,85,18,1,1,2]);
+ done();
+ });
+ });
+
it ("should ignore files that do not exists", function(done){
process.env.TRAVIS_JOB_ID = -1;
var lcovpath = __dirname + "/../fixtures/istanbul.lcov";