<commit_before>const TestSuite =  require('./');
const {Logger} = require('../utils');
const logger = require('../utils/logger');
try {
  var Cucumber = require('@cucumber/cucumber');
  var Cli =  require('@cucumber/cucumber/lib/cli').default;
  var UserCodeRunner = require('@cucumber/cucumber/lib/user_code_runner').default;
} catch (err) {
  if (err.code === 'MODULE_NOT_FOUND') {
    Logger.error('Cucumber not installed');
    logger.info('You can  install it using "npm i @cucumber/cucumber"');
    process.exit(0);
  } else {throw err}
}

module.exports = class CucumberSuite extends TestSuite {
  constructor({modulePath, modules, settings, argv, addtOpts}) {
    super({modulePath, modules, settings, argv, addtOpts});
    this.settings = settings;
    
    //force all nightwatch commands to return promise
    this.settings.always_async_commands = true;

    const {options} = this.settings.test_runner;
    this.cucumberParallelWorkers = options ? options.parallel : false;
    this.feature_path = options.feature_path;
    this.cucumberCli = new Cli({argv: [process.execPath, require.resolve('@cucumber/cucumber'), this.feature_path, ...this.cucumberParallelWorkers ? ['--require', 'lib/runner/test-runners/_setup_cucumber_parallel_runner.js'] : [], '--require', modulePath, ...argv.tags ? ['--tags', argv.tags] : [], ...this.cucumberParallelWorkers ? ['--parallel', this.cucumberParallelWorkers] : [], '--world-parameters', JSON.stringify(argv)], cwd: process.cwd(), stdout: process.stdout});
  }

  createContext() {
    this.context = {
      unitTestingMode: false,
      getDesiredCapabilities: () => false,
      getEndSessionOnFail: () => true
    };
  };
  

  init() {
    this.addPropertiesToGlobalScope();
    this.createContext();
    this.createClient();

    // Remove timeout from cucumber-runner
    const originalCodeRunner = UserCodeRunner.run;
    UserCodeRunner.run =   function(props) {
      props.timeoutInMilliseconds = -1;

      return originalCodeRunner.call(this, props);
    };

  }<commit_msg>update cucumber testsuite<commit_after>const TestSuite =  require('./');
const {Logger} = require('../utils');
const logger = require('../utils/logger');
try {
  var Cucumber = require('@cucumber/cucumber');
  var Cli =  require('@cucumber/cucumber/lib/cli').default;
  var UserCodeRunner = require('@cucumber/cucumber/lib/user_code_runner').default;
} catch (err) {
  if (err.code === 'MODULE_NOT_FOUND') {
    Logger.error('Cucumber not installed');
    logger.info('You can  install it using "npm i @cucumber/cucumber"');
    process.exit(0);
  } else {throw err}
}

module.exports = class CucumberSuite extends TestSuite {
  constructor({modulePath, modules, settings, argv, addtOpts}) {
    super({modulePath, modules, settings, argv, addtOpts});
    this.settings = settings;
    
    //force all nightwatch commands to return promise
    this.settings.always_async_commands = true;

    const {options} = this.settings.test_runner;
    this.cucumberParallelWorkers = options ? options.parallel : false;
    this.feature_path = Array.isArray(options.feature_path) ? options.feature_path : [options.feature_path];
    this.specs = [];
    modules.forEach(module => {
      this.specs.push('--require', module);
    });
    this.cucumberCli = new Cli({argv: [process.execPath, require.resolve('@cucumber/cucumber'), ...this.feature_path, ...this.cucumberParallelWorkers ? ['--require', 'lib/runner/test-runners/_setup_cucumber_parallel_runner.js'] : [], ...this.specs, ...argv.tags ? ['--tags', argv.tags] : [], ...this.cucumberParallelWorkers ? ['--parallel', this.cucumberParallelWorkers] : [], '--world-parameters', JSON.stringify(argv)], cwd: process.cwd(), stdout: process.stdout});
  }

  createContext() {
    this.context = {
      unitTestingMode: false,
      getDesiredCapabilities: () => false,
      getEndSessionOnFail: () => true
    };
  };
  

  init() {
    this.addPropertiesToGlobalScope();
    this.createContext();
    this.createClient();

    // Remove timeout from cucumber-runner
    const originalCodeRunner = UserCodeRunner.run;
    UserCodeRunner.run =   function(props) {
      props.timeoutInMilliseconds = -1;

      return originalCodeRunner.call(this, props);
    };

  }
{'fraction_non_alphanumeric': 0.15406360424028268, 'fraction_numerical': 0.0009422850412249705, 'mean_word_length': 3.8973471741637833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '6312080', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1318, 'n_words': 253}