alphascript-server
Version:
CRUD operations for mongo and other functionalities to get started quickly in any CMS project
26 lines (22 loc) • 677 B
JavaScript
var fs = require('fs');
var path = require('path');
module.exports = function (app) {
fs.readdir(__dirname, function (err, tests) {
if (err) return console.log("tests failed to initialize:", err);
tests = tests.filter(function(test) {
return test !== "index.js";
});
runTests(tests, app, function (err) {
console.log("tests:", err || "ok");
});
});
};
function runTests(tests, app, callback) {
if (tests.length === 0) return callback();
var test = tests[0];
tests.splice(0, 1);
require(path.join(__dirname, test))(app, function (err) {
console.log(tests.length, test, err || "ok");
runTests(tests, app, callback);
});
}