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 /lib | |
| 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 'lib')
| -rw-r--r-- | lib/convertLcovToCoveralls.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/convertLcovToCoveralls.js b/lib/convertLcovToCoveralls.js index e925343..68687bd 100644 --- a/lib/convertLcovToCoveralls.js +++ b/lib/convertLcovToCoveralls.js @@ -23,6 +23,16 @@ var convertLcovFileObject = function(file, filepath){ coverage : coverage }; }; +var cleanFilePath = function(file) { + if (file.indexOf('!') > -1) { + var regex = /^(.*!)(.*)$/g; + var matches = regex.exec(file); + return matches[matches.length-1]; + } + + return file; +}; + var convertLcovToCoveralls = function(input, options, cb){ var filepath = options.filepath || ''; logger.debug("in: ", filepath); @@ -61,6 +71,7 @@ var convertLcovToCoveralls = function(input, options, cb){ postJson.service_pull_request = options.service_pull_request; } parsed.forEach(function(file){ + file.file = cleanFilePath(file.file); var currentFilePath = path.resolve(filepath, file.file); if (fs.existsSync(currentFilePath)) { postJson.source_files.push(convertLcovFileObject(file, filepath)); |
