Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mochaOptions.grep = new RegExp(
parseString(process.env['chimp.mochaTags']).split(',').map(escapeRegExp).join('|')
);
}
var mocha = new Mocha(mochaOptions);
mocha.addFile(path.join(path.resolve(__dirname, path.join('mocha-helper.js'))));
if (process.argv.length > 3) {
process.argv.splice(3).forEach(function (spec) {
mocha.addFile(spec);
});
} else {
// Add each .js file to the mocha instance
var testDir = process.env['chimp.path'];
glob.sync(path.join(testDir, '**')).filter(function (file) {
// Only keep the .js files
return file.substr(-3) === '.js';
}).forEach(function (file) {
mocha.addFile(file);
});
}
try {
// Run the tests.
mocha.run(function (failures) {
exit(failures);
});
} catch (e) {
throw (e);
}
mochaOptions.grep = new RegExp((0, _environmentVariableParsers.parseString)(process.env['chimp.watchTags']).split(',').map(_escapeRegExp2.default).join('|'));
} else {
mochaOptions.grep = new RegExp((0, _environmentVariableParsers.parseString)(process.env['chimp.mochaTags']).split(',').map(_escapeRegExp2.default).join('|'));
}
var mocha = new Mocha(mochaOptions);
mocha.addFile(path.join(path.resolve(__dirname, path.join('mocha-helper.js'))));
if (process.argv.length > 3) {
process.argv.splice(3).forEach(function (spec) {
mocha.addFile(spec);
});
} else {
// Add each .js file to the mocha instance
var testDir = process.env['chimp.path'];
glob.sync(path.join(testDir, '**')).filter(function (file) {
// Only keep the .js files
return file.substr(-3) === '.js';
}).forEach(function (file) {
mocha.addFile(file);
});
}
try {
// Run the tests.
mocha.run(function (failures) {
exit(failures);
});
} catch (e) {
throw e;
}
new Fiber(function runJasmineInFiber() {
const projectDir = process.env.PWD;
const testsDir = process.env['chimp.path'];
process.chdir(testsDir);
const Jasmine = require('jasmine');
const jasmine = new Jasmine();
// Capability to add multiple spec filters
const specFilters = [];
jasmine.env.specFilter = function shouldRunSpec(spec) {
return _.every(specFilters, specFilter => specFilter(spec));
};
jasmine.jasmine.addSpecFilter = function addSpecFilter(filterFn) {
specFilters.push(filterFn);
};
if (parseBoolean(process.env['chimp.watch'])) {
new _fibers2.default(function runJasmineInFiber() {
var testsDir = process.env['chimp.path'];
process.chdir(testsDir);
var Jasmine = require('jasmine');
var jasmine = new Jasmine();
// Capability to add multiple spec filters
var specFilters = [];
jasmine.env.specFilter = function shouldRunSpec(spec) {
return _underscore2.default.every(specFilters, function (specFilter) {
return specFilter(spec);
});
};
jasmine.jasmine.addSpecFilter = function addSpecFilter(filterFn) {
specFilters.push(filterFn);
};