Comparing version 2.8.0 to 2.10.0
@@ -16,7 +16,8 @@ var TRAVIS_JOB_ID = process.env.TRAVIS_JOB_ID || 'unknown'; | ||
var convertLcovFileObject = function(file, filepath){ | ||
filepath = path.resolve(filepath, file.file); | ||
var rootpath = filepath; | ||
filepath = path.resolve(rootpath, file.file); | ||
var source = fs.readFileSync(filepath, 'utf8'); | ||
var lines = source.split("\n"); | ||
var coverage = detailsToCoverage(lines.length, file.lines.details); | ||
return { name : file.file, | ||
return { name : path.relative(rootpath, path.resolve(rootpath, file.file)), | ||
source : source, | ||
@@ -23,0 +24,0 @@ coverage : coverage }; |
@@ -17,2 +17,9 @@ var fs = require('fs'); | ||
if (process.env.DRONE){ | ||
options.service_name = 'drone'; | ||
options.service_job_id = process.env.DRONE_BUILD_NUMBER; | ||
git_commit = process.env.DRONE_COMMIT; | ||
git_branch = process.env.DRONE_BRANCH; | ||
} | ||
if (process.env.JENKINS_URL){ | ||
@@ -19,0 +26,0 @@ options.service_name = 'jenkins'; |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "2.8.0", | ||
"version": "2.10.0", | ||
"bugs": { | ||
@@ -11,0 +11,0 @@ "url": "https://github.com/cainus/node-coveralls/issues" |
@@ -5,2 +5,4 @@ #node-coveralls | ||
[![Codeship Build Status](https://www.codeship.io/projects/de6fb440-dea9-0130-e7d9-122ca7ee39d3/status)](https://www.codeship.io/projects/5622) | ||
[![Build | ||
Status](https://drone.io/github.com/cainus/node-coveralls/status.png)](https://drone.io/github.com/cainus/node-coveralls/latest) | ||
@@ -7,0 +9,0 @@ [Coveralls.io](https://coveralls.io/) support for node.js. Get the great coverage reporting of coveralls.io and add a cool coverage button ( like the one above ) to your README. |
@@ -6,2 +6,3 @@ var convertLcovToCoveralls = require('../index').convertLcovToCoveralls; | ||
var logger = require('../lib/logger'); | ||
var path = require('path'); | ||
logger = require('log-driver')({level : false}); | ||
@@ -12,4 +13,4 @@ | ||
process.env.TRAVIS_JOB_ID = -1; | ||
var path = __dirname + "/../fixtures/onefile.lcov"; | ||
var input = fs.readFileSync(path, "utf8"); | ||
var lcovpath = __dirname + "/../fixtures/onefile.lcov"; | ||
var input = fs.readFileSync(lcovpath, "utf8"); | ||
var libpath = __dirname + "/../fixtures/lib"; | ||
@@ -35,4 +36,4 @@ convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ | ||
getOptions(function(err, options){ | ||
var path = __dirname + "/../fixtures/onefile.lcov"; | ||
var input = fs.readFileSync(path, "utf8"); | ||
var lcovpath = __dirname + "/../fixtures/onefile.lcov"; | ||
var input = fs.readFileSync(lcovpath, "utf8"); | ||
var libpath = "fixtures/lib"; | ||
@@ -49,4 +50,4 @@ options.filepath = libpath; | ||
process.env.TRAVIS_JOB_ID = -1; | ||
var path = __dirname + "/../fixtures/onefile.lcov"; | ||
var input = fs.readFileSync(path, "utf8"); | ||
var lcovpath = __dirname + "/../fixtures/onefile.lcov"; | ||
var input = fs.readFileSync(lcovpath, "utf8"); | ||
var libpath = "fixtures/lib"; | ||
@@ -60,2 +61,27 @@ convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ | ||
}); | ||
it ("should convert absolute input paths to relative", function(done){ | ||
process.env.TRAVIS_JOB_ID = -1; | ||
var lcovpath = __dirname + "/../fixtures/istanbul.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); | ||
} | ||
convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ | ||
fs.readFileSync = originalReadFileSync; | ||
should.not.exist(err); | ||
output.source_files[0].name.should.equal(path.join("svgo", "config.js")); | ||
done(); | ||
}); | ||
}); | ||
}); |
@@ -52,2 +52,5 @@ var should = require('should'); | ||
}); | ||
it ("should set service_name and service_job_id if it's running on drone", function(done){ | ||
testDrone(getBaseOptions, done); | ||
}); | ||
}); | ||
@@ -123,2 +126,5 @@ | ||
}); | ||
it ("should set service_name and service_job_id if it's running on drone", function(done){ | ||
testDrone(getBaseOptions, done); | ||
}); | ||
}); | ||
@@ -308,2 +314,23 @@ | ||
var testDrone = function(sut, done) { | ||
process.env.DRONE = true; | ||
process.env.DRONE_BUILD_NUMBER = '1234'; | ||
process.env.DRONE_COMMIT = "e3e3e3e3e3e3e3e3e"; | ||
process.env.DRONE_BRANCH = "master"; | ||
sut(function(err, options){ | ||
options.service_name.should.equal("drone"); | ||
options.service_job_id.should.equal("1234"); | ||
options.git.should.eql({ head: | ||
{ id: 'e3e3e3e3e3e3e3e3e', | ||
author_name: 'Unknown Author', | ||
author_email: '', | ||
committer_name: 'Unknown Committer', | ||
committer_email: '', | ||
message: 'Unknown Commit Message' }, | ||
branch: 'master', | ||
remotes: [] }); | ||
done(); | ||
}); | ||
}; | ||
function ensureLocalGitContext(options) { | ||
@@ -310,0 +337,0 @@ var path = require('path'); |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
207935
6888
108
87