<commit_before>// BEGIN - Static server for test html
var finalhandler = require('finalhandler'),
    http         = require('http'),
    serveStatic  = require('serve-static'),
    Mocha        = require('mocha'),
    Saucelabs    = require('saucelabs'),
    testState    = require('./helpers/state');

require('colors');

// Serve up project root
var serve = serveStatic('./');

// Create server
var server = http.createServer(function(req, res) {
    var done = finalhandler(req, res);
    serve(req, res, done);
});

// Listen
server.listen(3000);
// END - Static server

function reportTestDetails() {
    if (testState.get('isReported')) {
        return;
    }
    if (process.env.SAUCE_USERNAME && process.env.TRAVIS_JOB_NUMBER && testState.get('sauceSessionId')) {
        var sauce = new Saucelabs({
            username: process.env.SAUCE_USERNAME,
            password: process.env.SAUCE_ACCESS_KEY
        });
        console.log(('  Test suite reported as ' + (testState.get('isFailing') ? 'failed' : 'passed\n')).yellow);
        return sauce.updateJob(testState.get('sauceSessionId'), {passed: !testState.get('isFailing')}, function () {});
    }
    testState.update({isReported: true});
}

var mocha = new Mocha({
    ui: 'bdd',
    reporter: 'spec'
});
mocha.addFile('test/conductor.js');

// browserConfig.set(browsers.shift());
var runner = mocha.run(function(failures) {
    process.exit(failures);
});
runner.on('fail', function() {
    testState.update({isFailing: true});
    reportTestDetails();
});
runner.on('suite', function() {
    testState.reset();
});
runner.on('suite end', function() {
    return reportTestDetails();
});

// browsers.forEach(function(browser) {
//     browserConfig.set(browser);
//     // Start up Mocha
//     var runner   = mocha.run(),
//         isFailed = false;
//     runner.on('fail', function() {
//         isFailed = true;
//     });
//     runner.on('end', function() {<commit_msg>Trying to fix issues with async saucelabs API calls<commit_after>// BEGIN - Static server for test html
var finalhandler = require('finalhandler'),
    http         = require('http'),
    serveStatic  = require('serve-static'),
    Mocha        = require('mocha'),
    Saucelabs    = require('saucelabs'),
    testState    = require('./helpers/state');

require('colors');

// Serve up project root
var serve = serveStatic('./');

// Create server
var server = http.createServer(function(req, res) {
    var done = finalhandler(req, res);
    serve(req, res, done);
});

// Listen
server.listen(3000);
// END - Static server

function reportTestDetails(done) {
    if (testState.get('isReported')) {
        return;
    }
    if (process.env.SAUCE_USERNAME && process.env.TRAVIS_JOB_NUMBER && testState.get('sauceSessionId')) {
        var sauce = new Saucelabs({
            username: process.env.SAUCE_USERNAME,
            password: <PASSWORD>_<PASSWORD>_<PASSWORD>
        });
        console.log(('  Test suite reported as ' + (testState.get('isFailing') ? 'failed' : 'passed\n')).yellow);
        sauce.updateJob(testState.get('sauceSessionId'), {passed: !testState.get('isFailing')}, function () {
            done();
        });
    }
    testState.update({isReported: true});
}

var mocha = new Mocha({
    ui: 'bdd',
    reporter: 'spec'
});
mocha.addFile('test/conductor.js');

// browserConfig.set(browsers.shift());
var runner = mocha.run(function(failures) {
    process.exit(failures);
});
runner.on('fail', function() {
    testState.update({isFailing: true});
    reportTestDetails();
});
runner.on('suite', function() {
    testState.reset();
});
runner.on('suite end', function(done) {
    reportTestDetails(done);
});

// browsers.forEach(function(browser) {
//     browserConfig.set(browser);
//     // Start up Mocha
//     var runner   = mocha.run(),
//         isFailed = false;
//     runner.on('fail', function() {
//         isFailed = true;
//     });
//     runner.on('end', function() {
{'fraction_non_alphanumeric': 0.1738581882412314, 'fraction_numerical': 0.0020186727226848347, 'mean_word_length': 3.082389289392379, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '2710980', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1251, 'n_words': 249}