How to use the glob.globSync function in glob

To help you get started, we’ve selected a few glob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github noblesamurai / cucumis / bin / cucumis.js View on Github external
var stat = fs.statSync(path.resolve(process.cwd(), runPath));
if (stat.isFile()) {
	var filePath = path.resolve(process.cwd(), runPath);
	runPattern = RegExp.escape('^' + filePath + '$');
	runPath = path.dirname(filePath);
}

// Load up env.js
globSync(path.resolve(process.cwd(), runPath, '**/env.js')).forEach(function (env) {
	require(env);
});

// Load up step definitions
var stepDefs = [];
try {
	globSync(path.resolve(process.cwd(), runPath, '**/*.js'))
		.filter(function(value) {
			return !value.match(/\/env.js$/);
		})
		.forEach(function(file) {
			var mod = require(file);
			if (mod instanceof Array) {
				var newDefs = mod.filter(function (item) {
					return (item.operator) && (item.pattern instanceof RegExp) && (item.generator instanceof Function);
				});
				stepDefs = stepDefs.concat(newDefs);
			}
		});
} catch (err) {}

runFeatures(runPath, runPattern);
github noblesamurai / cucumis / bin / cucumis.js View on Github external
if (runPath === null) {
	runPath = 'features';
}

var runPattern = '\.feature$';

var stat = fs.statSync(path.resolve(process.cwd(), runPath));
if (stat.isFile()) {
	var filePath = path.resolve(process.cwd(), runPath);
	runPattern = RegExp.escape('^' + filePath + '$');
	runPath = path.dirname(filePath);
}

// Load up env.js
globSync(path.resolve(process.cwd(), runPath, '**/env.js')).forEach(function (env) {
	require(env);
});

// Load up step definitions
var stepDefs = [];
try {
	globSync(path.resolve(process.cwd(), runPath, '**/*.js'))
		.filter(function(value) {
			return !value.match(/\/env.js$/);
		})
		.forEach(function(file) {
			var mod = require(file);
			if (mod instanceof Array) {
				var newDefs = mod.filter(function (item) {
					return (item.operator) && (item.pattern instanceof RegExp) && (item.generator instanceof Function);
				});
github weepy / brequire / lib / brequire.js View on Github external
compile.prototype._files = function() {
  var files = []
  
  for(var i=0; i < this.search_paths.length; i++) {
    
    var p = path.join(this.root, this.search_paths[i])
    var x = glob(p)
    files = files.concat(x)
  }
  
  var ret = []
  for(var i=0; i