Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
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);
});
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