<commit_before>/**
 * Mocha runner
 */

const utils = require('../utils');
const seleniumTesting = require('./selenium-testing');
const mochaCode = require('raw!mocha/mocha.js');
const evaluate = require('../utils/evaluate');
const logger = require('../utils/logger').create('Mocha-runner');

const DEFAULT_OPTIONS = {
  ui: 'bdd',
  timeout: 10 * 1000,
};

class MochaRunner {
  /**
   * Constructor
   *
   * @param {Object} context where to load mocha
   */
  constructor(context) {
    this._context = context;
    evaluate.asFunction(mochaCode, {global: this._context});
  }

  /**
   * Setup mocha instance
   *
   * @param {Object} [options]
   * @param {Object} [options.ui]
   * @param {Object} [options.reporter]
   * @param {Object} [options.timeout]
   */
  setup(options) {
    options = Object.assign({}, DEFAULT_OPTIONS, utils.noUndefined(options));
    this._context.mocha.setup(options);
    this._storeFilenames();
    seleniumTesting.wrapMochaGlobals(this._context);
  }

  hasTests() {
    const suite = this._context.mocha.suite;
    return suite.suites.length || suite.tests.length;<commit_msg>set default timeout 30s<commit_after>/**
 * Mocha runner
 */

const utils = require('../utils');
const seleniumTesting = require('./selenium-testing');
const mochaCode = require('raw!mocha/mocha.js');
const evaluate = require('../utils/evaluate');
const logger = require('../utils/logger').create('Mocha-runner');

const DEFAULT_OPTIONS = {
  ui: 'bdd',
  timeout: 30 * 1000,
};

class MochaRunner {
  /**
   * Constructor
   *
   * @param {Object} context where to load mocha
   */
  constructor(context) {
    this._context = context;
    evaluate.asFunction(mochaCode, {global: this._context});
  }

  /**
   * Setup mocha instance
   *
   * @param {Object} [options]
   * @param {Object} [options.ui]
   * @param {Object} [options.reporter]
   * @param {Object} [options.timeout]
   */
  setup(options) {
    options = Object.assign({}, DEFAULT_OPTIONS, utils.noUndefined(options));
    this._context.mocha.setup(options);
    this._storeFilenames();
    seleniumTesting.wrapMochaGlobals(this._context);
  }

  hasTests() {
    const suite = this._context.mocha.suite;
    return suite.suites.length || suite.tests.length;
{'fraction_non_alphanumeric': 0.16146297948260482, 'fraction_numerical': 0.006244424620874219, 'mean_word_length': 3.6535269709543567, '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': '6407914', 'n_tokens_mistral': 765, 'n_tokens_neox': 721, 'n_words': 144}