diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/convertLcovToCoveralls.js | 10 | ||||
| -rw-r--r-- | lib/detectLocalGit.js | 4 |
2 files changed, 4 insertions, 10 deletions
diff --git a/lib/convertLcovToCoveralls.js b/lib/convertLcovToCoveralls.js index 15bf962..b73863a 100644 --- a/lib/convertLcovToCoveralls.js +++ b/lib/convertLcovToCoveralls.js @@ -13,11 +13,7 @@ var detailsToCoverage = function(length, details){ }; var convertLcovFileObject = function(file, filepath){ - if (file.file[0] !== '/'){ - filepath = path.join(filepath, file.file); - } else { - filepath = file.file; - } + filepath = path.resolve(filepath, file.file); var source = fs.readFileSync(filepath, 'utf8'); var lines = source.split("\n"); var coverage = detailsToCoverage(lines.length, file.lines.details); @@ -29,9 +25,7 @@ var convertLcovFileObject = function(file, filepath){ var convertLcovToCoveralls = function(input, options, cb){ var filepath = options.filepath || ''; logger.debug("in: ", filepath); - if (filepath[0] !== '/'){ - filepath = path.join(process.cwd(), filepath); - } + filepath = path.resolve(process.cwd(), filepath); lcovParse(input, function(err, parsed){ if (err){ logger.error("error from lcovParse: ", err); diff --git a/lib/detectLocalGit.js b/lib/detectLocalGit.js index 3d381db..302cd44 100644 --- a/lib/detectLocalGit.js +++ b/lib/detectLocalGit.js @@ -5,7 +5,7 @@ var REGEX_BRANCH = /^ref: refs\/heads\/(\w+)$/; module.exports = function detectLocalGit(knownCommit, knownBranch) { var dir = process.cwd(), gitDir; - while ('/' !== dir) { + while (path.resolve('/') !== dir) { gitDir = path.join(dir, '.git'); var existsSync = fs.existsSync || path.existsSync; if (existsSync(path.join(gitDir, 'HEAD'))) @@ -14,7 +14,7 @@ module.exports = function detectLocalGit(knownCommit, knownBranch) { dir = path.dirname(dir); } - if ('/' === dir) + if (path.resolve('/') === dir) return; var head = fs.readFileSync(path.join(dir, '.git', 'HEAD'), 'utf-8').trim(); |
