<commit_before>var wd = require('wd'),
    chai = require('chai'),
    chaiAsPromised = require('chai-as-promised'),
    Q = require('q'),
    Mocha = require('mocha'),
    argh = require('argh'),
    util = require('util'),
    _ = require('underscore'),
    config = require('./config'),
    enableWDLogging = require('./lib/logging'),
    spotlight = require('./lib/spotlight'),
    driver = require('./lib/driver'),
    server = require('./lib/server'),
    dashboardTest = require('./lib/tests/dashboard');

util._extend(config, argh.argv);

chai.use(chaiAsPromised);
chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;

var mocha = new Mocha({
  reporter: config.reporter,
  timeout: config.timeout,
  slow: config.slow,
  grep: argh.argv.grep
});

require('./lib/wd-helpers')(wd, config);

var browser = wd.promiseChainRemote({port: config.port}),
  exitcode = 1;

enableWDLogging(browser);

if (config.reporter === 'json') {
  console.log = function () {};
}

function testDashboards(config, prefix) {
  prefix = prefix || '';
  var title = [prefix, 'Dashboards'].join(' ');
  return spotlight.init(config)()
    .then(spotlight.dashboards)
    .then(function (dashboards) {

      var range = (argh.argv.range || '').split('..');
      range[0] = parseInt(range[0], 10) || 0;
      if (range.length === 1) {
        range[1] = range[0] + 1;
      } else {
        range[1] = range[1] ? parseInt(range[1], 10) : dashboards.length;
      }

      var suite = Mocha.Suite.create(mocha.suite, title);
      dashboards.forEach(function (dashboard, i) {
        if (i >= range[0] && i < range[1]) {
          dashboardTest(browser, dashboard, suite, config);
        }
      });
    });
}<commit_msg>Default to all tests if range is not defined<commit_after>var wd = require('wd'),
    chai = require('chai'),
    chaiAsPromised = require('chai-as-promised'),
    Q = require('q'),
    Mocha = require('mocha'),
    argh = require('argh'),
    util = require('util'),
    _ = require('underscore'),
    config = require('./config'),
    enableWDLogging = require('./lib/logging'),
    spotlight = require('./lib/spotlight'),
    driver = require('./lib/driver'),
    server = require('./lib/server'),
    dashboardTest = require('./lib/tests/dashboard');

util._extend(config, argh.argv);

chai.use(chaiAsPromised);
chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;

var mocha = new Mocha({
  reporter: config.reporter,
  timeout: config.timeout,
  slow: config.slow,
  grep: argh.argv.grep
});

require('./lib/wd-helpers')(wd, config);

var browser = wd.promiseChainRemote({port: config.port}),
  exitcode = 1;

enableWDLogging(browser);

if (config.reporter === 'json') {
  console.log = function () {};
}

function testDashboards(config, prefix) {
  prefix = prefix || '';
  var title = [prefix, 'Dashboards'].join(' ');
  return spotlight.init(config)()
    .then(spotlight.dashboards)
    .then(function (dashboards) {

      var range = (argh.argv.range || '').split('..');
      range[0] = parseInt(range[0], 10) || 0;
      if (range.length === 1 && argh.argv.range) {
        range[1] = range[0] + 1;
      } else {
        range[1] = range[1] ? parseInt(range[1], 10) : dashboards.length;
      }

      var suite = Mocha.Suite.create(mocha.suite, title);
      dashboards.forEach(function (dashboard, i) {
        if (i >= range[0] && i < range[1]) {
          dashboardTest(browser, dashboard, suite, config);
        }
      });
    });
}
{'fraction_non_alphanumeric': 0.1843607305936073, 'fraction_numerical': 0.009703196347031963, 'mean_word_length': 3.2796092796092795, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3411879', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1174, 'n_words': 229}