<commit_before>/*
 Thali unit test implementation of tape. Highly inspired by wrapping-tape, and
 usage is very similar to the wrapping tape:

 var tape = require('thaliTape');

 var test = tape({
 setup: function(t) {
 // will be called after each test has started to setup the test
 // after the next line, the actual test code will be executed
 t.end();
 },
 teardown: function(t) {
 // will be called after each device has ended the test
 // do any final tear down for the test in here
 t.end();
 }
 });
 */

'use strict';

var util = require('util');
var uuid = require('node-uuid');
var tape = require('tape-catch');
var io = require('socket.io-client');
var testUtils = require('./testUtils');

process.on('uncaughtException', function (err) {
  testUtils.logMessageToScreen('Uncaught Exception: ' + err);
  console.log(err.stack);
  console.log('****TEST_LOGGER:[PROCESS_ON_EXIT_FAILED]****');
  process.exit(1);
});

process.on('unhandledRejection', function (err, p) {
  testUtils.logMessageToScreen('Uncaught Promise Rejection: ' + err);
  console.trace(err);
  console.log('****TEST_LOGGER:[PROCESS_ON_EXIT_FAILED]****');
  process.exit(1);
});

var tests = {};
var allSuccess = true;

var emitWhenConnected = function (socket, name, data) {
  if (socket.connected) {
    data ? socket.emit(name, data) : socket.emit(name);
  } else {
    setTimeout(function () {
      emitWhenConnected(socket, name, data);
    }, 1000);
  }
};

function declareTest(testServer, name, setup, teardown, opts, cb) {<commit_msg>Add stack to error log<commit_after>/*
 Thali unit test implementation of tape. Highly inspired by wrapping-tape, and
 usage is very similar to the wrapping tape:

 var tape = require('thaliTape');

 var test = tape({
 setup: function(t) {
 // will be called after each test has started to setup the test
 // after the next line, the actual test code will be executed
 t.end();
 },
 teardown: function(t) {
 // will be called after each device has ended the test
 // do any final tear down for the test in here
 t.end();
 }
 });
 */

'use strict';

var util = require('util');
var uuid = require('node-uuid');
var tape = require('tape-catch');
var io = require('socket.io-client');
var testUtils = require('./testUtils');

process.on('uncaughtException', function (err) {
  testUtils.logMessageToScreen('Uncaught Exception: ' + err);
  console.log(err.stack);
  console.log('****TEST_LOGGER:[PROCESS_ON_EXIT_FAILED]****');
  process.exit(1);
});

process.on('unhandledRejection', function (err, p) {
  testUtils.logMessageToScreen('Uncaught Promise Rejection: ' + err);
  console.trace(err);
  console.log(err.stack);
  console.log('****TEST_LOGGER:[PROCESS_ON_EXIT_FAILED]****');
  process.exit(1);
});

var tests = {};
var allSuccess = true;

var emitWhenConnected = function (socket, name, data) {
  if (socket.connected) {
    data ? socket.emit(name, data) : socket.emit(name);
  } else {
    setTimeout(function () {
      emitWhenConnected(socket, name, data);
    }, 1000);
  }
};

function declareTest(testServer, name, setup, teardown, opts, cb) {
{'fraction_non_alphanumeric': 0.15232218252679441, 'fraction_numerical': 0.003897369275738876, 'mean_word_length': 4.384615384615385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3289276', 'n_tokens_mistral': 983, 'n_tokens_neox': 978, 'n_words': 289}