50f638daecf067a04cca010c39e6e0b34f06e689.svn-base
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'use strict';
const logger = require('./logger')();
const index = require('..');
function handleInput(input, cb, userOptions) {
logger.debug(input);
logger.debug(`user options ${userOptions}`);
index.getOptions((err, options) => {
if (err) {
logger.error('error from getOptions');
cb(err);
return;
}
logger.debug(options);
index.convertLcovToCoveralls(input, options, (err, postData) => {
if (err) {
logger.error('error from convertLcovToCoveralls');
cb(err);
return;
}
logger.info('sending this to coveralls.io: ', JSON.stringify(postData));
index.sendToCoveralls(postData, (err, response, body) => {
if (err) {
cb(err);
return;
}
if (response.statusCode >= 400) {
cb(`Bad response: ${response.statusCode} ${body}`);
return;
}
logger.debug(response.statusCode);
logger.debug(body);
cb(null, body);
});
});
}, userOptions);
}
module.exports = handleInput;