comforter-cli
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ #! /usr/bin/env node | ||
var chalk = require('chalk'); | ||
var restler = require('restler'); | ||
var request = require('request'); | ||
var fs = require('fs'); | ||
@@ -65,4 +65,3 @@ var targz = require('tar.gz'); | ||
try { | ||
var size = fs.statSync(argv.path).size; | ||
data.lcov = restler.file(argv.path, 'lcov.info', size); | ||
data.lcov = fs.createReadStream(argv.path); | ||
} catch (err) { | ||
@@ -97,5 +96,3 @@ fail(errors.lcovFile, err); | ||
} | ||
var zipSize = fs.statSync('coverage.zip').size; | ||
data.zip = restler.file('coverage.zip', 'coverage.zip', zipSize); | ||
data.zip = fs.createReadStream('coverage.zip'); | ||
deferred.resolve(); | ||
@@ -115,15 +112,12 @@ }); | ||
// send multi-part request | ||
restler.post(argv.host + 'api/apps/' + argv.project + '/coverage?apiKey=' + data.apiKey, { | ||
multipart: true, | ||
data: data | ||
}) | ||
var config = { | ||
url: argv.host + 'api/apps/' + argv.project + '/coverage?apiKey=' + data.apiKey, | ||
formData: data | ||
}; | ||
// successful upload | ||
.on('success', function (data) { | ||
console.log('Comforter Coverage: ' + chalk.green(data.coverage)); | ||
}) | ||
// network failure or other issue with the request | ||
.on('error', fail.bind(null, errors.network)) | ||
.on('fail', fail.bind(null, errors.badRequest)); | ||
request.post(config, function (err, response, body) { | ||
if (err) return fail.bind(null, errors.network); | ||
if (response.statusCode >= 400) return fail.bind(null, errors.badRequest); | ||
console.log('Comforter Coverage: ' + chalk.green(body.coverage)); | ||
}); | ||
}) | ||
@@ -130,0 +124,0 @@ .catch(fail.bind(null, errors.badRequest)); |
{ | ||
"name": "comforter-cli", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"description": "cli tool for communicating with comforter instance", | ||
@@ -29,3 +29,3 @@ "scripts": { | ||
"q": "^1.4.1", | ||
"restler": "^3.4.0", | ||
"request": "^2.88.0", | ||
"rimraf": "^2.5.0", | ||
@@ -32,0 +32,0 @@ "tar.gz": "^1.0.2" |
@@ -36,3 +36,3 @@ 'use strict'; | ||
code.expect(err).to.exist(); | ||
code.expect(err.toString()).to.contain('LCOV file could not be found'); | ||
code.expect(err.toString()).to.contain('ENOENT'); | ||
done(); // dont pass err cuz we are expecting err | ||
@@ -39,0 +39,0 @@ }); |
10062
-1.77%156
-2.5%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed