<commit_before>var fs = require('fs');
var codecov = require("../lib/codecov");
var execSync = require('child_process').execSync;
if (!execSync) {
  var exec = require('execSync').exec;
  var execSync = function(cmd){
    return exec(cmd).stdout;
  };
}


describe("Codecov", function(){
  it("can get upload to v2", function(done){
    codecov.sendToCodecovV2('https://codecov.io',
                            {
                              token: '<KEY>',
                              commit: '<KEY>',
                              branch: 'master'
                            },
                            'testing node-'+codecov.version,
                            function(body){
                              expect(body).to.contain('http://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a');
                              done();
                            },
                            function(err){
                              throw err;
                            });
  });

  it("can get upload to v3", function(done){
    codecov.sendToCodecovV3('https://codecov.io',
                            {
                              token: '<KEY>',
                              commit: '<KEY>',
                              branch: 'master'
                            },
                            'testing node-'+codecov.version,
                            function(body){
                              expect(body).to.contain('http://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a');
                              done();
                            },
                            function(err){
                              throw err;
                            });
  });

});
<commit_msg>added test for runtime exception when offline<commit_after>var fs = require('fs');
var codecov = require("../lib/codecov");
var execSync = require('child_process').execSync;
if (!execSync) {
  var exec = require('execSync').exec;
  var execSync = function(cmd){
    return exec(cmd).stdout;
  };
}


describe("Codecov", function(){
  it("can get upload to v2", function(done){
    codecov.sendToCodecovV2('https://codecov.io',
                            {
                              token: '<KEY>',
                              commit: 'c739768fcac68144a3a6d82305b9c4106934d31a',
                              branch: 'master'
                            },
                            'testing node-'+codecov.version,
                            function(body){
                              expect(body).to.contain('http://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a');
                              done();
                            },
                            function(errCode, errMsg){
                              if(errCode === 'EAI_AGAIN'){
                                console.log('Offline - can not run this test');
                                done();
                              }
                              throw err;
                            });
  });

  it("can get upload to v3", function(done){
    codecov.sendToCodecovV3('https://codecov.io',
                            {
                              token: '<KEY>',
                              commit: 'c739768fcac68144a3a6d82305b9c4106934d31a',
                              branch: 'master'
                            },
                            'testing node-'+codecov.version,
                            function(body){
                              expect(body).to.contain('http://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a');
                              done();
                            },
                            function(errCode, errMsg){
                              if(errCode === 'EAI_AGAIN'){
                                console.log('Offline - can not run this test');
                                done();
                              }
                              throw err;
                            });
  });

  it("upload v2 doesn't throw runtime error", function(done){
    expect(codecov.sendToCodecovV2.bind(null,
                            'https://codecov.io',
                            {
                              token: '<KEY>',
                              commit: 'c739768fcac68144a3a6d82305b9c4106934d31a',
                              branch: 'master'
                            },
                            'testing node-'+codecov.version,
                            function(body){
                              expect(body).to.contain('http://codecov.io/github/codecov/ci-repo/commit/c739768fcac68144a3a6d82305b9c4106934d31a');
                              done();
                            },
                            function(errCode, errMsg){
                              if(errCode === 'EAI_AGAIN'){
                                done();
                              }
                              throw err;
                            }
      )).to.not.throwException();
  })

});

{'fraction_non_alphanumeric': 0.10861934477379095, 'fraction_numerical': 0.04563182527301092, 'mean_word_length': 0.9267468069120962, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7270007', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1269, 'n_words': 180}