locations.map(function (location) { fs .readdirSync(location) .filter(function (file) { return file.substr(-3) == ".js"; }) .map(function (file) { mocha.addFile(path.join(location, file)); }); });
function addFiles(files) { return new Promise((resolve) => { files.forEach((file) => { debug(`adding ${file} file`); mocha.addFile(path.join(testFolder, file)); }); resolve(); }); }
// Add each .js file to the mocha instance fs.readdirSync(testDir).filter(function(file){ // Only keep the .js files return file.substr(-3) === '.js'; }).forEach(function(file){ mocha.addFile( path.join(testDir, file) ); });
async function run() { if (config.general.environment.toLowerCase() === 'production') { log.info('Tests should not be run in Production mode, it affects your configured database') log.info('If you know what you are doing, set config.general.environment to "Test" first') process.exit() } const tests = await getFiles(`${__dirname}/tests`) tests.filter((file) => file.substr(-3) === '.js').forEach((filePath) => mocha.addFile(filePath)) mocha.run((failures) => { process.exitCode = failures ? 1 : 0 process.exit() }) }
files.forEach(function(file) { file = path.join(__dirname, file); mocha.addFile(file); });
// add all spec files to mocha recursive(SPEC_SOURCE_DIR, function (err, files) { if (err) { console.error(err); return exit(1); } var mocha = new Mocha({timeout: 1000 * 60}); // specially load bootstrap file mocha.addFile(path.join(SPEC_SOURCE_DIR, '_bootstrap.js')); files.filter(function (file) { // extract all test files return (file.substr(-8) === '.test.js'); }).forEach(mocha.addFile.bind(mocha)); mocha.run(function (err) { err && console.error(err.stack || err); exit(err ? 1 : 0); }); });
function MochaTester(filename) { mocha.addFile(filename);
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
files.forEach(function (file) { mocha.addFile(file); });
mocha.addFile(testFilePath); mocha.run((err) => { if (err) {
}).forEach(mocha.addFile.bind(mocha));
// Get all mocha test files DirectoryAll.forEach(function(element) { FS.readdirSync(element) .filter(function(file) { return file.substr(-3) === '.js'; }) .forEach(function(file) { MochaInstanceAll.addFile(PT.join(element, file)); }); });
// Add each .js file to the mocha instance fs.readdirSync(testFileOrDir).filter(function(file) { // Only keep the .js files return file.endsWith('.js') }).forEach(function(file){ mocha.addFile( path.join(testFileOrDir, file) ) })
// Add test files fs.readdirSync(testDir).filter(file => { // Only keep the .js files return file.substr(-3) === '.js'; }).forEach(file => { mocha.addFile( path.join(testDir, file) ); });
fs.readdirSync(location).filter(function (file) { return (file.substr(-3) == '.js'); }).forEach(function (file) { mocha.addFile(path.join(location, file)); });