Comparing version 2.0.4 to 2.0.5
@@ -22,12 +22,16 @@ #!/usr/bin/env node | ||
var postData = convertLcovToCoveralls(input, libDir); | ||
sendToCoveralls(postData, function(err, response, body){ | ||
convertLcovToCoveralls(input, libDir, function(err, postData){ | ||
if (err){ | ||
throw err; | ||
} | ||
if (response.statusCode >= 400){ | ||
throw "Bad response: " + response.statusCode + " " + body; | ||
} | ||
console.log(response.statusCode); | ||
console.log(body); | ||
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); | ||
}); | ||
}); | ||
@@ -34,0 +38,0 @@ |
var TRAVIS_JOB_ID = process.env.TRAVIS_JOB_ID || 'unknown'; | ||
var fs = require('fs'); | ||
var lcovParse = require('./parser'); | ||
var lcovParse = require('lcov-parse'); | ||
var path = require('path'); | ||
@@ -24,3 +24,3 @@ | ||
var convertLcovToCoveralls = function(input, filepath){ | ||
var convertLcovToCoveralls = function(input, filepath, cb){ | ||
console.log("in: ", filepath); | ||
@@ -30,12 +30,14 @@ if (filepath[0] !== '/'){ | ||
} | ||
var parsed = lcovParse(input); | ||
var postJson = { | ||
service_job_id : TRAVIS_JOB_ID, | ||
service_name : "travis-ci", | ||
source_files : [] | ||
}; | ||
parsed.forEach(function(file){ | ||
postJson.source_files.push(convertLcovFileObject(file, filepath)); | ||
}); | ||
return postJson; | ||
lcovParse(input, function(err, parsed){ | ||
if (err){ return cb(err); } | ||
var postJson = { | ||
service_job_id : TRAVIS_JOB_ID, | ||
service_name : "travis-ci", | ||
source_files : [] | ||
}; | ||
parsed.forEach(function(file){ | ||
postJson.source_files.push(convertLcovFileObject(file, filepath)); | ||
}); | ||
return cb(null, postJson); | ||
}); | ||
}; | ||
@@ -42,0 +44,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"keywords" : ["coverage", "coveralls"], | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"bugs": { | ||
@@ -24,3 +24,4 @@ "url": "https://github.com/cainus/node-coveralls/issues" | ||
"dependencies": { | ||
"request" : "2.16.2" | ||
"request" : "2.16.2", | ||
"lcov-parse" : "0.0.3" | ||
}, | ||
@@ -27,0 +28,0 @@ "devDependencies" : { |
@@ -11,7 +11,9 @@ var convertLcovToCoveralls = require('../lib/convertLcovToCoveralls'); | ||
var libpath = __dirname + "/../fixtures/lib"; | ||
var output = convertLcovToCoveralls(input, libpath); | ||
output.source_files[0].name.should.equal("index.js"); | ||
output.source_files[0].source.split("\n").length.should.equal(225); | ||
output.source_files[0].coverage[54].should.equal(0); | ||
output.source_files[0].coverage[60].should.equal(0); | ||
convertLcovToCoveralls(input, 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].coverage[54].should.equal(0); | ||
output.source_files[0].coverage[60].should.equal(0); | ||
}); | ||
}); | ||
@@ -24,6 +26,8 @@ | ||
var libpath = "fixtures/lib"; | ||
var output = convertLcovToCoveralls(input, libpath); | ||
output.source_files[0].name.should.equal("index.js"); | ||
output.source_files[0].source.split("\n").length.should.equal(225); | ||
convertLcovToCoveralls(input, 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); | ||
}); | ||
}); | ||
}); |
168055
2
11
5925
+ Addedlcov-parse@0.0.3
+ Addedlcov-parse@0.0.3(transitive)