Comparing version 2.0.9 to 2.0.10
#!/usr/bin/env node | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var YAML = require('libyaml'); | ||
var sendToCoveralls = require('../lib/sendToCoveralls'); | ||
var convertLcovToCoveralls = require('../lib/convertLcovToCoveralls'); | ||
var repo_token; | ||
var handleInput = require('../lib/handleInput'); | ||
var logger = require('log-driver')({level : 'warn'}); | ||
var options = {}; | ||
if (process.argv[2]) { | ||
if (~['-v', '--verbose'].indexOf(process.argv[2])) { | ||
options.verbose = true; | ||
if (options.verbose){ | ||
logger = require('log-driver')({level : 'debug'}); | ||
} | ||
if (process.argv[3]) { | ||
options.filepath = process.argv[3]; | ||
} | ||
} else { | ||
options.filepath = process.argv[2]; | ||
} | ||
} | ||
process.stdin.resume(); | ||
@@ -19,38 +30,4 @@ process.stdin.setEncoding('utf8'); | ||
process.stdin.on('end', function() { | ||
inputToCoveralls(input); | ||
handleInput(input, options); | ||
}); | ||
var inputToCoveralls = function(input){ | ||
console.log(input); | ||
var libDir = process.argv[2] || ''; | ||
if (process.env.COVERALLS_REPO_TOKEN) { | ||
repo_token = process.env.COVERALLS_REPO_TOKEN; | ||
} else { | ||
var yml = path.join(process.cwd(), '.coveralls.yml'); | ||
try { | ||
if (fs.statSync(yml).isFile()) { | ||
repo_token = YAML.readFileSync(yml)[0].repo_token; | ||
} | ||
} catch(ex){ | ||
console.log("Repo token could not be determined. Continuing without it."); | ||
} | ||
} | ||
convertLcovToCoveralls(input, libDir, repo_token, function(err, postData){ | ||
if (err){ | ||
throw err; | ||
} | ||
sendToCoveralls(postData, function(err, response, body){ | ||
if (err){ | ||
throw err; | ||
} | ||
if (response.statusCode >= 400){ | ||
throw "Bad response: " + response.statusCode + " " + body; | ||
} | ||
console.log(response.statusCode); | ||
console.log(body); | ||
}); | ||
}); | ||
}; |
@@ -158,54 +158,2 @@ var nodeUrl = require('url'); | ||
/* | ||
UrlGrey.prototype.absolute = function(path){ | ||
if (path[0] == '/'){ | ||
path = path.substring(1); | ||
} | ||
var parsed = nodeUrl.parse(path); | ||
if (!!parsed.protocol){ // if it's already absolute, just return it | ||
return path; | ||
} | ||
return this._protocol + "://" + this._host + '/' + path; | ||
}; | ||
// TODO make this interpolate vars into the url. both sinatra style and url-tempates | ||
// TODO name this: | ||
UrlGrey.prototype.get = function(nameOrPath, varDict){ | ||
if (!!nameOrPath){ | ||
if (!!varDict){ | ||
return this.absolute(this._router.getUrl(nameOrPath, varDict)); | ||
} | ||
return this.absolute(this._router.getUrl(nameOrPath)); | ||
} | ||
return this.url; | ||
};*/ | ||
/* | ||
// TODO needs to take a template as an input | ||
UrlGrey.prototype.param = function(key, defaultValue){ | ||
var value = this.params()[key]; | ||
if (!!value) { | ||
return value; | ||
} | ||
return defaultValue; | ||
}; | ||
// TODO extract params, given a template? | ||
// TODO needs to take a template as an input | ||
UrlGrey.prototype.params = function(inUrl){ | ||
if (!!inUrl){ | ||
return this._router.pathVariables(inUrl); | ||
} | ||
if (!!this._params){ | ||
return this._params; | ||
} | ||
return this._router.pathVariables(this.url); | ||
}; | ||
*/ | ||
// TODO relative() // takes an absolutepath and returns a relative one | ||
// TODO absolute() // takes a relative path and returns an absolute one. | ||
module.exports = function(url){ return new UrlGrey(url); }; | ||
@@ -212,0 +160,0 @@ |
@@ -5,2 +5,3 @@ var TRAVIS_JOB_ID = process.env.TRAVIS_JOB_ID || 'unknown'; | ||
var path = require('path'); | ||
var logger = require('log-driver').logger; | ||
@@ -29,4 +30,6 @@ var detailsToCoverage = function(length, details){ | ||
var convertLcovToCoveralls = function(input, filepath, repo_token, cb){ | ||
console.log("in: ", filepath); | ||
var convertLcovToCoveralls = function(input, options, cb){ | ||
var repo_token = options.repo_token, | ||
filepath = options.filepath || ''; | ||
logger.debug("in: ", filepath); | ||
if (filepath[0] !== '/'){ | ||
@@ -36,3 +39,7 @@ filepath = path.join(process.cwd(), filepath); | ||
lcovParse(input, function(err, parsed){ | ||
if (err){ return cb(err); } | ||
if (err){ | ||
logger.error("error from lcovParse: ", err); | ||
logger.error("input: ", input); | ||
return cb(err); | ||
} | ||
var postJson = { | ||
@@ -39,0 +46,0 @@ source_files : [] |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"bugs": { | ||
@@ -14,3 +14,3 @@ "url": "https://github.com/cainus/node-coveralls/issues" | ||
"scripts": { | ||
"test": "make test" | ||
"test": "make test-coveralls" | ||
}, | ||
@@ -23,3 +23,3 @@ "bin": { | ||
], | ||
"contributors" : [ | ||
"contributors": [ | ||
"Alan Gutierrez <alan@prettyrobots.com> (http://www.prettyrobots.com/)", | ||
@@ -32,7 +32,10 @@ "Kir Belevich (https://github.com/svg)", | ||
"request": "2.16.2", | ||
"lcov-parse": "0.0.4" | ||
"lcov-parse": "0.0.4", | ||
"log-driver": "1.2.1" | ||
}, | ||
"devDependencies": { | ||
"mocha-lcov-reporter": "0.0.1", | ||
"mocha": "1.8.1", | ||
"should": "1.1.0" | ||
"should": "1.1.0", | ||
"jscoverage": "0.3.7" | ||
}, | ||
@@ -39,0 +42,0 @@ "engines": { |
#node-coveralls | ||
[![Build Status](https://travis-ci.org/cainus/node-coveralls.png?branch=master)](https://travis-ci.org/cainus/node-coveralls) | ||
[![Coverage Status](https://coveralls.io/repos/cainus/node-coveralls/badge.png?branch=master)](https://coveralls.io/r/cainus/node-coveralls?branch=master) | ||
[Coveralls.io](https://coveralls.io/) support for node.js. Get the great coverage reporting of coveralls.io and add a cool coverage button ( like this: ![](https://s3.amazonaws.com/assets.coveralls.io/badges/coveralls_94.png) ) to your README. | ||
Installation: Add the latest version of `coveralls` to your package.json. | ||
Installation: Add the latest version of `coveralls` to your package.json: | ||
``` | ||
npm install coveralls --save | ||
``` | ||
@@ -8,0 +12,0 @@ This script ( `bin/coveralls.js` ) can take standard input from any tool that emits the lcov data format (including [mocha](http://visionmedia.github.com/mocha/)'s [LCov reporter](https://npmjs.org/package/mocha-lcov-reporter)) and send it to coveralls.io to report your code coverage there. |
@@ -1,2 +0,2 @@ | ||
var convertLcovToCoveralls = require('../lib/convertLcovToCoveralls'); | ||
var convertLcovToCoveralls = require('../index').convertLcovToCoveralls; | ||
var should = require('should'); | ||
@@ -11,6 +11,6 @@ var fs = require('fs'); | ||
var libpath = __dirname + "/../fixtures/lib"; | ||
convertLcovToCoveralls(input, libpath, null, function(err, output){ | ||
convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ | ||
should.not.exist(err); | ||
output.source_files[0].name.should.equal("index.js"); | ||
output.source_files[0].source.split("\n").length.should.equal(225); | ||
output.source_files[0].source.split("\n").length.should.equal(173); | ||
output.source_files[0].coverage[54].should.equal(0); | ||
@@ -26,8 +26,8 @@ output.source_files[0].coverage[60].should.equal(0); | ||
var libpath = "fixtures/lib"; | ||
convertLcovToCoveralls(input, libpath, null, function(err, output){ | ||
convertLcovToCoveralls(input, {filepath: libpath}, function(err, output){ | ||
should.not.exist(err); | ||
output.source_files[0].name.should.equal("index.js"); | ||
output.source_files[0].source.split("\n").length.should.equal(225); | ||
output.source_files[0].source.split("\n").length.should.equal(173); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171724
15
27
4
4
5936
12
+ Addedlog-driver@1.2.1
+ Addedlog-driver@1.2.1(transitive)