<commit_before>/*jshint -W030, -W020 */

DEBUG = !!process.env.VELOCITY_DEBUG;

(function () {

  'use strict';

  var path = Npm.require('path');

  var FRAMEWORK_NAME = 'cucumber',
      FRAMEWORK_REGEX = FRAMEWORK_NAME + '/.+\\.(feature|js|coffee|litcoffee|coffee\\.md)$',
      SAMPLE_TESTS = [{
        contents: Assets.getText(path.join('src', 'sample-tests', 'feature.feature')),
        path: path.join(FRAMEWORK_NAME, 'features', 'sample.feature')
      }, {
        contents: Assets.getText(path.join('src', 'sample-tests', 'steps.js')),
        path: path.join(FRAMEWORK_NAME, 'features', 'step_definitions', 'sample_steps.js')
      }, {
        contents: Assets.getText(path.join('src', 'sample-tests', 'fixture.js')),
        path: path.join(FRAMEWORK_NAME, 'my_fixture.js')
      }];

  if (process.env.NODE_ENV !== 'development' || process.env.IS_MIRROR ||
    process.env[FRAMEWORK_NAME.toUpperCase()] === '0' || process.env.VELOCITY === '0') {
    return;
  }

  DEBUG && console.log('[xolvio:cucumber] Cucumber hub is loading');

  if (Velocity && Velocity.registerTestingFramework) {
    Velocity.registerTestingFramework(FRAMEWORK_NAME, {
      regex: FRAMEWORK_REGEX,
      sampleTestGenerator: function () { return SAMPLE_TESTS; }
    });
  }

  Meteor.startup(function () {
    Meteor.call('velocity/mirrors/request', {
      framework: FRAMEWORK_NAME,
      args: ['--raw-logs'],
      nodes: 1
    });

    var initOnce = _.once(Meteor.bindEnvironment(_init));
    VelocityMirrors.find({framework: FRAMEWORK_NAME, state: 'ready'}).observe({
      added: initOnce,
      changed: initOnce
    });
  });

  function _init () {

    if (!!process.env.CUCUMBER_SPLIT_FEATURES) {

      var debouncedRun = _.debounce(Meteor.bindEnvironment(_run), 300);
      VelocityTestFiles.find({targetFramework: FRAMEWORK_NAME}).observeChanges({
        added: debouncedRun,
        removed: debouncedRun,
        changed: debouncedRun
      });
      process.on('SIGUSR2', Meteor.bindEnvironment(debouncedRun));
      process.on('message', Meteor.bindEnvironment(function (message) {
        if (message.refresh && message.refresh === 'client') {
          debouncedRun();<commit_msg>fixtures now work with cukes<commit_after>/*jshint -W030, -W020 */

DEBUG = !!process.env.VELOCITY_DEBUG;

(function () {

  'use strict';

  var path = Npm.require('path');

  var FRAMEWORK_NAME = 'cucumber',
      FRAMEWORK_REGEX = FRAMEWORK_NAME + '/.+\\.(feature|js|coffee|litcoffee|coffee\\.md)$',
      SAMPLE_TESTS = [{
        contents: Assets.getText(path.join('src', 'sample-tests', 'feature.feature')),
        path: path.join(FRAMEWORK_NAME, 'features', 'sample.feature')
      }, {
        contents: Assets.getText(path.join('src', 'sample-tests', 'steps.js')),
        path: path.join(FRAMEWORK_NAME, 'features', 'step_definitions', 'sample_steps.js')
      }, {
        contents: Assets.getText(path.join('src', 'sample-tests', 'fixture.js')),
        path: path.join(FRAMEWORK_NAME, 'fixtures', 'my_fixture.js')
      }];

  if (process.env.NODE_ENV !== 'development' || process.env.IS_MIRROR ||
    process.env[FRAMEWORK_NAME.toUpperCase()] === '0' || process.env.VELOCITY === '0') {
    return;
  }

  DEBUG && console.log('[xolvio:cucumber] Cucumber hub is loading');

  if (Velocity && Velocity.registerTestingFramework) {
    Velocity.registerTestingFramework(FRAMEWORK_NAME, {
      regex: FRAMEWORK_REGEX,
      sampleTestGenerator: function () { return SAMPLE_TESTS; }
    });
  }

  Meteor.startup(function () {
    Meteor.call('velocity/mirrors/request', {
      framework: FRAMEWORK_NAME,
      args: ['--raw-logs'],
      testsPath: path.join(FRAMEWORK_NAME, 'fixtures'),
      nodes: 1
    });

    var initOnce = _.once(Meteor.bindEnvironment(_init));
    VelocityMirrors.find({framework: FRAMEWORK_NAME, state: 'ready'}).observe({
      added: initOnce,
      changed: initOnce
    });
  });

  function _init () {

    if (!!process.env.CUCUMBER_SPLIT_FEATURES) {

      var debouncedRun = _.debounce(Meteor.bindEnvironment(_run), 300);
      VelocityTestFiles.find({targetFramework: FRAMEWORK_NAME}).observeChanges({
        added: debouncedRun,
        removed: debouncedRun,
        changed: debouncedRun
      });
      process.on('SIGUSR2', Meteor.bindEnvironment(debouncedRun));
      process.on('message', Meteor.bindEnvironment(function (message) {
        if (message.refresh && message.refresh === 'client') {
          debouncedRun();
{'fraction_non_alphanumeric': 0.16081413554014762, 'fraction_numerical': 0.005815253858197271, 'mean_word_length': 3.463073852295409, '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': '6914187', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1462, 'n_words': 231}