aboutsummaryrefslogtreecommitdiff
path: root/test/convertLcovToCoveralls.js
diff options
context:
space:
mode:
authorNick Merwin <[email protected]>2017-02-05 12:35:46 -0800
committerNick Merwin <[email protected]>2017-02-05 12:35:46 -0800
commit15750503b69c3143b3020fa5d4fe4fc1d455356e (patch)
tree6119c9160780898ed4504ac3c082407202fef24d /test/convertLcovToCoveralls.js
parentc81c084fc7280c68e8dc470c31e7291eea183c22 (diff)
downloadnode-coveralls-branching.tar.xz
node-coveralls-branching.zip
branching WIPbranching
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";