src/feature-finder.js
function getFeatureFiles(args, ignoreArg) {
  var files = [];
  var patterns = args.length ? args : ['.'];

  patterns.forEach(function(pattern) {
    // First we need to fix up the pattern so that it only matches .feature files
    // and it's in the format that glob expects it to be
    var fixedPattern;
    if (pattern == '.') {
      fixedPattern = '**/*.feature';
    } else if (pattern.match(/.*\/\*\*/)) {
      fixedPattern = pattern + '/**.feature';
    } else if (pattern.match(/.*\.feature/)) {
      fixedPattern = pattern;
    } else {
      try {
        if (fs.statSync(pattern).isDirectory()) {
          fixedPattern = path.join(pattern, '**/*.feature');
        }
      } catch(e) {
        // Don't show the fs callstack, we will print a custom error message bellow instead
      }
    }

    if (!fixedPattern) {
      logger.boldError(`Invalid format of the feature file path/pattern: "${pattern}".\nTo run the linter please specify an existing feature file, directory or glob.`);
      process.exit(1);
      return; // This line will only be hit by tests that stub process.exit
    }

    var globOptions = {ignore: getIgnorePatterns(ignoreArg)};
    files = files.concat(glob.sync(fixedPattern, globOptions));
  });
  return _.uniq(files);
}
function getFeatureFiles(args, ignoreArg) {
  var files = [];
  var patterns = args.length ? args : ['.'];

  patterns.forEach(function(pattern) {
    // First we need to fix up the pattern so that it only matches .feature files
    // and it's in the format that glob expects it to be
    var fixedPattern;
    if (pattern == '.') {
      fixedPattern = '**/*.feature';
    } else if (pattern.match(/.*\/\*\*/)) {
      fixedPattern = pattern + '/**.feature';
    } else if (pattern.match(/.*\.feature/)) {
      fixedPattern = pattern;
    } else {
      try {
        if (fs.statSync(pattern).isDirectory()) {
          fixedPattern = path.join(pattern, '**/*.feature');
        }
      } catch(e) {
        // Don't show the fs callstack, we will print a custom error message bellow instead
      }
    }

    if (!fixedPattern) {
      logger.boldError(`Invalid format of the feature file path/pattern: "${pattern}".\nTo run the linter please specify an existing feature file, directory or glob.`);
      process.exit(1);
      return; // This line will only be hit by tests that stub process.exit
    }

    var globOptions = {ignore: getIgnorePatterns(ignoreArg)};
    files = files.concat(glob.sync(fixedPattern, globOptions));
  });
  return _.uniq(files);
}
function getFeatureFiles ( args , ignoreArg ) { var files = [ ] ; var patterns = args . length ? args : [ '.' ] ; patterns . forEach ( function ( pattern ) { // First we need to fix up the pattern so that it only matches .feature files // and it's in the format that glob expects it to be var fixedPattern ; if ( pattern == '.' ) { fixedPattern = '**/*.feature' ; } else if ( pattern . match ( / .*\/\*\* / ) ) { fixedPattern = pattern + '/**.feature' ; } else if ( pattern . match ( / .*\.feature / ) ) { fixedPattern = pattern ; } else { try { if ( fs . statSync ( pattern ) . isDirectory ( ) ) { fixedPattern = path . join ( pattern , '**/*.feature' ) ; } } catch ( e ) { // Don't show the fs callstack, we will print a custom error message bellow instead } } if ( ! fixedPattern ) { logger . boldError ( ` ${ pattern } \n ` ) ; process . exit ( 1 ) ; return ; // This line will only be hit by tests that stub process.exit } var globOptions = { ignore : getIgnorePatterns ( ignoreArg ) } ; files = files . concat ( glob . sync ( fixedPattern , globOptions ) ) ; } ) ; return _ . uniq ( files ) ; }
Ignore node_modules by default
Ignore node_modules by default