node-postgres/test/run.js

26 lines
478 B
JavaScript
Raw Normal View History

2010-10-11 07:50:05 +08:00
//executes all the unit tests
var fs = require('fs');
var args = require(__dirname + '/cli');
2010-10-24 07:20:29 +08:00
var runDir = function(dir) {
fs.readdirSync(dir).forEach(function(file) {
if(file.indexOf(".js") < 0) {
return runDir(fs.realpathSync(dir + file) + "/");
}
require(dir + file.split('.js') [0]);
});
};
var arg = args.test;
2010-10-24 09:26:24 +08:00
if(arg == 'all') {
runDir(__dirname+'/unit/');
runDir(__dirname+'/integration/');
2010-10-24 09:26:24 +08:00
}
else {
runDir(__dirname+'/' + arg + '/');
2010-10-24 09:26:24 +08:00
}