diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/convertLcovToCoveralls.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/convertLcovToCoveralls.js b/lib/convertLcovToCoveralls.js index dfc467c..c390aab 100644 --- a/lib/convertLcovToCoveralls.js +++ b/lib/convertLcovToCoveralls.js @@ -1,6 +1,7 @@ var TRAVIS_JOB_ID = process.env.TRAVIS_JOB_ID || 'unknown'; var fs = require('fs'); var lcovParse = require('./parser'); +var path = require('path'); var detailsToCoverage = function(length, details){ var coverage = new Array(length); @@ -11,8 +12,8 @@ var detailsToCoverage = function(length, details){ }; var convertLcovFileObject = function(file, filepath){ - var path = filepath + "/" + file.file; - var source = fs.readFileSync(path, 'utf8'); + var fullpath = path.join(filepath, file.file); + var source = fs.readFileSync(fullpath, 'utf8'); var lines = source.split("\n"); var coverage = detailsToCoverage(lines.length, file.lines.details); return { name : file.file, @@ -23,13 +24,8 @@ var convertLcovFileObject = function(file, filepath){ var convertLcovToCoveralls = function(input, filepath){ console.log("in: ", filepath); if (filepath[0] !== '/'){ - filepath = process.cwd() + '/' + filepath; + filepath = path.join(process.cwd(), filepath); } - console.log("now: ", filepath); - if (filepath[filepath.length - 1] !== '/'){ - filepath = filepath + '/'; - } - console.log("abs: ", filepath); var parsed = lcovParse(input); var postJson = { service_job_id : TRAVIS_JOB_ID, |
