From acc1fd8315edc64ef5a0cb233143b7b85017fd4c Mon Sep 17 00:00:00 2001 From: Joshua Davis Date: Fri, 11 Nov 2016 10:08:57 -0500 Subject: added sample .lcov and test fixture for Issue #143 --- test/convertLcovToCoveralls.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js index b927f05..7e67f3d 100644 --- a/test/convertLcovToCoveralls.js +++ b/test/convertLcovToCoveralls.js @@ -117,4 +117,34 @@ describe("convertLcovToCoveralls", function(){ }); }); + it ("should parse file paths concatenated by typescript and ng 2", function(done) { + process.env.TRAVIS_JOB_ID = -1; + var lcovpath = __dirname + "/../fixtures/istanbul.remap.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 false; }; + + convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ + fs.readFileSync = originalReadFileSync; + fs.existsSync = originalExistsSync; + + should.not.exist(err); + output.source_files.should.be.empty(); + done(); + }); + + }); + }); -- cgit v1.2.3 From f9c36973d799da13faa4adaf48a8ddee6b711927 Mon Sep 17 00:00:00 2001 From: Joshua Davis Date: Fri, 11 Nov 2016 07:53:36 -0800 Subject: implemented code to parse concatenated file paths (fixes #143) --- test/convertLcovToCoveralls.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js index 7e67f3d..25a0e97 100644 --- a/test/convertLcovToCoveralls.js +++ b/test/convertLcovToCoveralls.js @@ -134,17 +134,16 @@ describe("convertLcovToCoveralls", function(){ }; var originalExistsSync = fs.existsSync; - fs.existsSync = function () { return false; }; + 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.should.be.empty(); + output.source_files[0].name.should.equal(path.join("svgo", "config.js")); done(); }); - }); }); -- cgit v1.2.3