diff options
| author | Nick Merwin <[email protected]> | 2016-11-11 08:32:27 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-11-11 08:32:27 -0800 |
| commit | d15a6f8a885e50de9759d98dba5bdce4c2dc7ae1 (patch) | |
| tree | 5ee52a82b2f3f4768cb215348b66072c0a9e3c54 /test | |
| parent | cbb1e46ddddb045b538bc63f834937ac92c34eb2 (diff) | |
| parent | f9c36973d799da13faa4adaf48a8ddee6b711927 (diff) | |
| download | node-coveralls-d15a6f8a885e50de9759d98dba5bdce4c2dc7ae1.tar.xz node-coveralls-d15a6f8a885e50de9759d98dba5bdce4c2dc7ae1.zip | |
Merge pull request #144 from a11smiles/master
Fixes #143 where .lcov files generated by Angular CLI & Typescript (istanbul.remap) have improper source file name
Diffstat (limited to 'test')
| -rw-r--r-- | test/convertLcovToCoveralls.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/convertLcovToCoveralls.js b/test/convertLcovToCoveralls.js index b927f05..25a0e97 100644 --- a/test/convertLcovToCoveralls.js +++ b/test/convertLcovToCoveralls.js @@ -117,4 +117,33 @@ 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 true; }; + + convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ + fs.readFileSync = originalReadFileSync; + fs.existsSync = originalExistsSync; + + should.not.exist(err); + output.source_files[0].name.should.equal(path.join("svgo", "config.js")); + done(); + }); + }); + }); |
