2014-04-30 09:28:43 +00:00
|
|
|
#!/usr/bin/env nodejs
|
2014-02-19 16:04:49 +00:00
|
|
|
process.chdir( __dirname );
|
2014-04-02 17:22:07 +00:00
|
|
|
var fs = require( 'fs' ),
|
|
|
|
|
path = require( 'path' ),
|
|
|
|
|
nodeunit = require( 'nodeunit' ),
|
2014-04-05 01:09:40 +00:00
|
|
|
db = require( './js/persistence' ),
|
2014-04-28 20:23:27 +00:00
|
|
|
cs = require('coffee-script'),
|
2014-04-02 17:22:07 +00:00
|
|
|
args = process.argv.slice( 2 ),
|
|
|
|
|
fEnd = function() {
|
2014-04-06 20:03:46 +00:00
|
|
|
console.log( 'Shutting down DB from unit_test.sh script. '
|
|
|
|
|
+'This might take as long as the event poller loop delay is...' );
|
2014-04-02 17:22:07 +00:00
|
|
|
db.shutDown();
|
|
|
|
|
};
|
|
|
|
|
|
2014-04-28 20:23:27 +00:00
|
|
|
if (cs.register) {
|
|
|
|
|
cs.register();
|
|
|
|
|
}
|
2014-02-19 16:04:49 +00:00
|
|
|
if( args[ 0 ] !== undefined ) {
|
|
|
|
|
var fl = path.resolve( args[ 0 ] );
|
|
|
|
|
if ( fs.existsSync( fl ) ) {
|
2014-04-02 17:22:07 +00:00
|
|
|
nodeunit.reporters.default.run( [ fl ], null, fEnd );
|
2014-02-19 16:04:49 +00:00
|
|
|
} else {
|
|
|
|
|
console.error( 'File not found!!' );
|
|
|
|
|
}
|
2014-02-17 22:27:26 +00:00
|
|
|
} else {
|
2014-04-02 17:22:07 +00:00
|
|
|
nodeunit.reporters.default.run( [ 'testing' ], null, fEnd );
|
2014-02-17 22:27:26 +00:00
|
|
|
}
|