New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

coveralls

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coveralls - npm Package Compare versions

Comparing version 2.0.12 to 2.0.13

test/getOptions.js

4

lib/getOptions.js
var fs = require('fs');
var path = require('path');
var YAML = require('libyaml');
var yaml = require('yaml');
var logger = require('./logger');

@@ -28,3 +28,3 @@

if (fs.statSync(yml).isFile()) {
options.repo_token = YAML.readFileSync(yml)[0].repo_token;
options.repo_token = yaml.eval(fs.readFileSync(yml, 'utf8')).repo_token;
}

@@ -31,0 +31,0 @@ } catch(ex){

@@ -1,12 +0,10 @@

var sendToCoveralls = require('../index').sendToCoveralls;
var convertLcovToCoveralls = require('../index').convertLcovToCoveralls;
var index = require('../index');
var logger = require('./logger');
var getOptions = require('../index').getOptions;
var handleInput = function(input){
logger.debug(input);
var options = getOptions();
var options = index.getOptions();
logger.debug(options);
convertLcovToCoveralls(input, options, function(err, postData){
index.convertLcovToCoveralls(input, options, function(err, postData){
if (err){

@@ -17,3 +15,3 @@ logger.error("error from convertLcovToCoveralls");

logger.info("sending this to coveralls.io: ", JSON.stringify(postData));
sendToCoveralls(postData, function(err, response, body){
index.sendToCoveralls(postData, function(err, response, body){
if (err){

@@ -20,0 +18,0 @@ throw err;

@@ -6,3 +6,3 @@ var request = require('request');

var url = 'https://coveralls.io/api/v1/jobs';
request({url : url, method : 'POST', form : { json : str}}, function(err, response, body){
request.post({url : url, form : { json : str}}, function(err, response, body){
cb(err, response, body);

@@ -9,0 +9,0 @@ });

@@ -8,3 +8,3 @@ {

],
"version": "2.0.12",
"version": "2.0.13",
"bugs": {

@@ -26,6 +26,6 @@ "url": "https://github.com/cainus/node-coveralls/issues"

"elliotcable <github@elliottcable.name> (http://elliottcable.name/)",
"Arpad Borsos <arpad.borsos@googlemail.com> (http://swatinem.de/)"
"Arpad Borsos <arpad.borsos@googlemail.com> (http://swatinem.de/)"
],
"dependencies": {
"libyaml": "0.2.2",
"yaml": "0.2.3",
"request": "2.16.2",

@@ -36,2 +36,3 @@ "lcov-parse": "0.0.4",

"devDependencies": {
"sinon-restore": "1.0.0",
"mocha-lcov-reporter": "0.0.1",

@@ -38,0 +39,0 @@ "mocha": "1.8.1",

var should = require('should');
var sinon = require('sinon-restore');
var index = require('../index');
var handleInput = index.handleInput;
var fs = require('fs');

@@ -8,15 +8,49 @@ logger = require('log-driver')({level : false});

describe("handleInput", function(){
it ("gets the default options and tries to convert input", function(done){
index.getOptions = function(){
console.log("got here: ", arguments);
};
index.convertLcovToCoveralls = function(){
console.log(arguments);
done();
};
afterEach(function() {
sinon.restoreAll();
});
it ("throws an error when there's an error sending", function(done){
sinon.stub(index, 'getOptions', function(){
return {};
});
sinon.stub(index, 'sendToCoveralls', function(postData, cb){
try {
cb("some error");
should.fail("expected exception was not raised");
} catch (ex) {
done();
}
});
var path = __dirname + "/../fixtures/onefile.lcov";
var input = fs.readFileSync(path, "utf8");
var handleInput = index.handleInput;
handleInput(input);
index.handleInput(input);
});
it ("throws an error when there's a bad status code", function(done){
sinon.stub(index, 'getOptions', function(){
return {};
});
sinon.stub(index, 'sendToCoveralls', function(postData, cb){
try {
cb(null, {statusCode : 500}, "body");
should.fail("expected exception was not raised");
} catch (ex) {
done();
}
});
var path = __dirname + "/../fixtures/onefile.lcov";
var input = fs.readFileSync(path, "utf8");
index.handleInput(input);
});
it ("completes successfully when there are now errors", function(done){
sinon.stub(index, 'getOptions', function(){
return {};
});
sinon.stub(index, 'sendToCoveralls', function(postData, cb){
cb(null, {statusCode : 200}, "body");
done();
});
var path = __dirname + "/../fixtures/onefile.lcov";
var input = fs.readFileSync(path, "utf8");
index.handleInput(input);
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc