<commit_before>/* eslint-disable no-process-exit */

const path = require('path');
const glob = require('glob');
const spawn = require('child_process').spawn;

function testPackage(pkg) {
  return new Promise((res, reject) => {
    let truffleBin = './node_modules/.bin/truffle';
    let proc = spawn(process.execPath, [truffleBin, 'test'], { stdio: ['ignore', process.stdout, process.stderr], cwd: pkg });
    proc.on('exit', function (code, signal) {
      if (signal) {
        process.kill(process.pid, signal);
      } else {
        if (code === 0) {
          res();
        } else {
          reject(new Error("child test suite exited with status " + code));
        }
      }
    });

    // terminate children.
    process.on('SIGINT', function () {
      proc.kill('SIGINT'); // calls runner.abort()
      proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
    });
  });
}

async function run() {
  let packages = glob.sync(path.join(__dirname, '..', '*', 'truffle.js')).map(p => path.dirname(p));
  for (let pkg of packages) {
    process.stdout.write(`Starting truffle test suite for ${path.basename(pkg)}\n`);
    await testPackage(pkg);
  }
  process.stdout.write(`Finished truffle test suites\n`);
}

run().then(() => process.exit(0), err => {
  /* eslint-disable no-console */
  console.log(err);
  process.exit(-1);
});
<commit_msg>making sure to use HUB_ENVIRONMENT=test in spawned truffle tests<commit_after>/* eslint-disable no-process-exit */

const path = require('path');
const glob = require('glob');
const spawn = require('child_process').spawn;

function testPackage(pkg) {
  return new Promise((res, reject) => {
    let truffleBin = './node_modules/.bin/truffle';
    let proc = spawn(process.execPath, [truffleBin, 'test'], {
      stdio: ['ignore', process.stdout, process.stderr],
      cwd: pkg,
      env: {
        HUB_ENVIRONMENT: 'test'
      }
    });
    proc.on('exit', function (code, signal) {
      if (signal) {
        process.kill(process.pid, signal);
      } else {
        if (code === 0) {
          res();
        } else {
          reject(new Error("child test suite exited with status " + code));
        }
      }
    });

    // terminate children.
    process.on('SIGINT', function () {
      proc.kill('SIGINT'); // calls runner.abort()
      proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
    });
  });
}

async function run() {
  let packages = glob.sync(path.join(__dirname, '..', '*', 'truffle.js')).map(p => path.dirname(p));
  for (let pkg of packages) {
    process.stdout.write(`Starting truffle test suite for ${path.basename(pkg)}\n`);
    await testPackage(pkg);
  }
  process.stdout.write(`Finished truffle test suites\n`);
}

run().then(() => process.exit(0), err => {
  /* eslint-disable no-console */
  console.log(err);
  process.exit(-1);
});

{'fraction_non_alphanumeric': 0.17701543739279588, 'fraction_numerical': 0.002058319039451115, 'mean_word_length': 2.9193548387096775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4772825', 'n_tokens_mistral': 937, 'n_tokens_neox': 929, 'n_words': 227}