<commit_before>
try
  chai = require 'chai'
catch err
  return

Runner = require('./runner').Runner
testsuite = require './testsuite'
subprocess = require './subprocess'

debug = require('./common').debug

runSuite = (runner, suite) ->

  suiteDescribe = if suite.skip then describe.skip else describe
  suiteDescribe "#{suite.name}", ->
    beforeEach (done) ->
      @timeout suite.timeout if suite.timeout?
      runner.setupSuite suite, done
    afterEach (done) ->
      runner.teardownSuite suite, done

    suite.cases.forEach (testcase) ->
       caseDescribe = if testcase.skip then describe.skip else describe
       caseDescribe testcase.name, ->
        it testcase.assertion, (done) ->
          @timeout suite.timeout if suite.timeout?
          @timeout testcase.timeout if testcase.timeout?

          runner.runTest testcase, (err, received) ->
            chai.expect(err).to.not.exist
            chai.expect(received).to.eql testcase.expect
            done()

## run()
# Must be be ran using Mocha,
# it is responsible for setting up the "describe", and "it" functions
exports.run = (rt, tests, options) ->
  runner = new Runner rt
  suites = testsuite.getSuitesSync tests
  process = null

  start = (callback) ->
    return callback null if not rt.command
    process = subprocess.start rt.command, callback
  stop = (callback) ->
    process.kill() if process
    return callback null<commit_msg>mocha: Output error in loading/parsing suites<commit_after>
try
  chai = require 'chai'
catch err
  return

Runner = require('./runner').Runner
testsuite = require './testsuite'
subprocess = require './subprocess'

debug = require('./common').debug

runSuite = (runner, suite) ->

  suiteDescribe = if suite.skip then describe.skip else describe
  suiteDescribe "#{suite.name}", ->
    beforeEach (done) ->
      @timeout suite.timeout if suite.timeout?
      runner.setupSuite suite, done
    afterEach (done) ->
      runner.teardownSuite suite, done

    suite.cases.forEach (testcase) ->
       caseDescribe = if testcase.skip then describe.skip else describe
       caseDescribe testcase.name, ->
        it testcase.assertion, (done) ->
          @timeout suite.timeout if suite.timeout?
          @timeout testcase.timeout if testcase.timeout?

          runner.runTest testcase, (err, received) ->
            chai.expect(err).to.not.exist
            chai.expect(received).to.eql testcase.expect
            done()

## run()
# Must be be ran using Mocha,
# it is responsible for setting up the "describe", and "it" functions
exports.run = (rt, tests, options) ->
  runner = new Runner rt
  console.log 'trying suites'
  try
    suites = testsuite.getSuitesSync tests
  catch e
    console.log 'Unable to get suites:', e
    throw e
  process = null

  start = (callback) ->
    return callback null if not rt.command
    process = subprocess.start rt.command, callback
  stop = (callback) ->
    process.kill() if process
    return callback null
{'fraction_non_alphanumeric': 0.10823529411764705, 'fraction_numerical': 0.0, 'mean_word_length': 2.859922178988327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '3169602', 'n_tokens_mistral': 857, 'n_tokens_neox': 848, 'n_words': 268}