[Pkg-javascript-commits] [node-coveralls] 281/332: implemented code to parse concatenated file paths (fixes #143)

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 13:54:11 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-coveralls.

commit f9c36973d799da13faa4adaf48a8ddee6b711927
Author: Joshua Davis <joshua at localhost.localdomain>
Date:   Fri Nov 11 07:53:36 2016 -0800

    implemented code to parse concatenated file paths (fixes #143)
---
 lib/convertLcovToCoveralls.js  | 11 +++++++++++
 test/convertLcovToCoveralls.js |  5 ++---
 2 files changed, 13 insertions(+), 3 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));
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();
     });
-
   });
 
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-coveralls.git



More information about the Pkg-javascript-commits mailing list