How to use coveralls

Comprehensive coveralls code examples:

How to use coveralls.getBaseOptions:

51
52
53
54
55
56
57
58
59
60
this.onExit = function(done) {
  read_lcov(filepath, finish);

  function finish(input) {
    if (!input) return done();
    coveralls.getBaseOptions(function(err, options) {
      options.filepath = ".";
      if ('repoToken' in coverallsReporter) options.repo_token = coverallsReporter.repoToken;
      coveralls.convertLcovToCoveralls(input, options, function(err, postData) {
        coveralls.sendToCoveralls(postData, function(err, response, body) {

How to use coveralls.sendToCoveralls:

55
56
57
58
59
60
61
62
63
64
if (!input) return done();
coveralls.getBaseOptions(function(err, options) {
  options.filepath = ".";
  if ('repoToken' in coverallsReporter) options.repo_token = coverallsReporter.repoToken;
  coveralls.convertLcovToCoveralls(input, options, function(err, postData) {
    coveralls.sendToCoveralls(postData, function(err, response, body) {
      log.info("uploading...");
      send_to_coveralls(done, err, response, body);
    });
  });

How to use coveralls.convertLcovToCoveralls:

54
55
56
57
58
59
60
61
62
63
function finish(input) {
  if (!input) return done();
  coveralls.getBaseOptions(function(err, options) {
    options.filepath = ".";
    if ('repoToken' in coverallsReporter) options.repo_token = coverallsReporter.repoToken;
    coveralls.convertLcovToCoveralls(input, options, function(err, postData) {
      coveralls.sendToCoveralls(postData, function(err, response, body) {
        log.info("uploading...");
        send_to_coveralls(done, err, response, body);
      });

How to use coveralls.io:

130
131
132
133
134
135
136
137
138
139
  }
  if ((response.statusCode >= 200 && response.statusCode < 300) && isJSON) {
    // TODO: log success sending to coveralls.io
    log.info("%d --- %s", response.statusCode, success(body));
  } else {
    // TODO: log error sending to coveralls.io
    log.info("%d --- %s", response.statusCode, body);
  }
  done();
}

How to use coveralls.handleInput:

237
238
239
240
241
242
243
244
    jscoverage.coverageDetail();
    /*var coverageStats = jscoverage.coverageStats();
    Object.keys(coverageStats).forEach(function(file) {
        test.equal(coverageStats[file].total, coverageStats[file].touched, 'All lines of code exercised by the tests');
    });*/
    if(process.env.TRAVIS) coveralls.handleInput(jscoverage.getLCOV());
    test.done();
};