aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNick Merwin <[email protected]>2017-03-05 11:12:45 -0800
committerNick Merwin <[email protected]>2017-03-05 11:12:45 -0800
commitd571dac62547f487b3862aca8bf367e95957d904 (patch)
tree9b3a600ce69411934329dfb757dc05a56c30b9a1 /test
parent8dfcfd6d8809e0678958a81f29474ee084d529fe (diff)
parent15750503b69c3143b3020fa5d4fe4fc1d455356e (diff)
downloadnode-coveralls-d571dac62547f487b3862aca8bf367e95957d904.tar.xz
node-coveralls-d571dac62547f487b3862aca8bf367e95957d904.zip
merge, version bump2.12.0
Diffstat (limited to 'test')
-rw-r--r--test/convertLcovToCoveralls.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js
index 31f40d9..eb67305 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){
delete process.env.TRAVIS;
var lcovpath = __dirname + "/../fixtures/istanbul.lcov";