node-postgres/test.js

21 lines
485 B
JavaScript
Raw Normal View History

2010-10-24 07:24:27 +08:00
#! /usr/local/bin/node
2010-10-11 07:50:05 +08:00
//executes all the unit tests
var fs = require('fs');
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]);
});
};
2010-10-24 09:26:24 +08:00
var arg = (process.argv[2] || "unit");
if(arg == 'all') {
runDir(__dirname+'/test/unit/');
runDir(__dirname+'/test/integration/');
}
else {
runDir(__dirname+'/test/' + + '/');
}