<commit_before>/**
 * Dependencies
 */

var path = require('path');
var fs = require('fs');
var _ = require('@sailshq/lodash');
var mocha = require('mocha');
var utils = require('./utils');
// var crossAdapterRunner = require('../features/crossAdapter/core/crossAdapter');

/**
 * Test Runner
 *
 * @param {Object} options
 * @api public
 */

module.exports = function(options) {
  if (!options.adapter) {
    throw new Error('Must supply an adapter');
  }

  if (!options.interfaces) {
    throw new Error('Must supply a list of supported interfaces');
  }

  if (!_.isArray(options.interfaces)) {
    throw new Error('Must supply a list of supported interfaces');
  }

  var adapter = options.adapter;
  var config = options.config || {};
  var interfaces = options.interfaces;
  var features = options.features || [];
  
  // cross-adapter is a special case since it requires a clean test cache for
  // running existing associations tests
  var crossAdapterIndex = _.indexOf(features, 'crossAdapter');
  if (crossAdapterIndex < 0) {
    crossAdapterIndex = _.indexOf(features, 'cross-adapter');
  }

  var runCrossAdapterTests;
  if(crossAdapterIndex >= 0){
    features.splice(crossAdapterIndex, 1);
    runCrossAdapterTests = true;
  }

  // Attach config to adapter
  global.Connections = {
    'test': config
  };

  global.Connections.test.adapter = 'wl_tests';

  // Globalize Adapter
  global.Adapter = adapter;

  // Build an array of files to test
  var filter = '\\.(' + ['js'].join('|') + ')$';

  var files = [];

  _.each(interfaces, function(interface) {
    var interfacePath = path.resolve(__dirname,'../interfaces/' + interface);
    files = files.concat(utils.fileLookup(interfacePath, filter, true));
  });

  // _.each(features, function(feature) {
  //   var parts = feature.split('.');
  //   if (parts.length > 2) {
  //     throw new Error("Only one level of sub-features is supported, please use only one '.': " + feature);
  //   }

  //   var featurePath = path.resolve(__dirname,'../features/' + parts[0] + '/core');
  //   if (fs.existsSync(featurePath)) {
  //     files = files.concat(utils.fileLookup(featurePath, filter, true));<commit_msg>Turn off cross-adapter tests for now<commit_after>/**
 * Dependencies
 */

var path = require('path');
var fs = require('fs');
var _ = require('@sailshq/lodash');
var mocha = require('mocha');
var utils = require('./utils');
// var crossAdapterRunner = require('../features/crossAdapter/core/crossAdapter');

/**
 * Test Runner
 *
 * @param {Object} options
 * @api public
 */

module.exports = function(options) {
  if (!options.adapter) {
    throw new Error('Must supply an adapter');
  }

  if (!options.interfaces) {
    throw new Error('Must supply a list of supported interfaces');
  }

  if (!_.isArray(options.interfaces)) {
    throw new Error('Must supply a list of supported interfaces');
  }

  var adapter = options.adapter;
  var config = options.config || {};
  var interfaces = options.interfaces;
  var features = options.features || [];
  
  // cross-adapter is a special case since it requires a clean test cache for
  // running existing associations tests
  // var crossAdapterIndex = _.indexOf(features, 'crossAdapter');
  // if (crossAdapterIndex < 0) {
  //   crossAdapterIndex = _.indexOf(features, 'cross-adapter');
  // }

  // var runCrossAdapterTests;
  // if(crossAdapterIndex >= 0){
  //   features.splice(crossAdapterIndex, 1);
  //   runCrossAdapterTests = true;
  // }
  
  // Turn cross-adapter tests off for now.
  var runCrossAdapterTests = false;

  // Attach config to adapter
  global.Connections = {
    'test': config
  };

  global.Connections.test.adapter = 'wl_tests';

  // Globalize Adapter
  global.Adapter = adapter;

  // Build an array of files to test
  var filter = '\\.(' + ['js'].join('|') + ')$';

  var files = [];

  _.each(interfaces, function(interface) {
    var interfacePath = path.resolve(__dirname,'../interfaces/' + interface);
    files = files.concat(utils.fileLookup(interfacePath, filter, true));
  });

  // _.each(features, function(feature) {
  //   var parts = feature.split('.');
  //   if (parts.length > 2) {
  //     throw new Error("Only one level of sub-features is supported, please use only one '.': " + feature);
  //   }

  //   var featurePath = path.resolve(__dirname,'../features/' + parts[0] + '/core');
  //   if (fs.existsSync(featurePath)) {
  //     files = files.concat(utils.fileLookup(featurePath, filter, true));
{'fraction_non_alphanumeric': 0.15670976370931788, 'fraction_numerical': 0.002229157378510923, 'mean_word_length': 3.289674952198853, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '288258', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1327, 'n_words': 359}