1- var Mocha = require ( 'mocha' ) ;
2- var fs = require ( 'fs' ) ;
3- var path = require ( 'path' ) ;
1+ var Mocha = require ( "mocha" ) ;
2+ var fs = require ( "fs" ) ;
3+ var path = require ( "path" ) ;
4+ var common = require ( "./common" ) ;
5+ var logging = require ( "./logging" ) ;
46var location = path . normalize ( path . join ( __dirname , "integration" ) ) ;
57var mocha = new Mocha ( {
68 reporter : "progress"
79} ) ;
810
11+ switch ( common . hasConfig ( common . protocol ( ) ) ) {
12+ case 'not-defined' :
13+ logging . error ( "There's no configuration for protocol **%s**" , common . protocol ( ) ) ;
14+ process . exit ( 0 ) ;
15+ case 'not-found' :
16+ logging . error ( "**test/config.js** missing. Take a look at **test/config.example.js**" ) ;
17+ process . exit ( 0 ) ;
18+ }
19+
920runTests ( ) ;
1021
1122function runTests ( ) {
@@ -19,8 +30,7 @@ function runTests() {
1930 ) ;
2031 } ) ;
2132
22- process . stdout . write ( "\033[1;34m[i] \033[0;34mTesting \033[1;34m" + process . env . ORM_PROTOCOL + "\033[0m\n" ) ;
23- process . stdout . write ( "\033[1;34m[i] \033[0;34mURI: \033[1;34m" + require ( './common' ) . getConnectionString ( ) + "\033[0m\n" ) ;
33+ logging . info ( "Testing **%s**" , common . getConnectionString ( ) ) ;
2434
2535 mocha . run ( function ( failures ) {
2636 process . exit ( failures ) ;
@@ -29,7 +39,7 @@ function runTests() {
2939
3040function shouldRunTest ( file ) {
3141 var name = file . substr ( 0 , file . length - 3 ) ;
32- var proto = process . env . ORM_PROTOCOL ;
42+ var proto = common . protocol ( ) ;
3343
3444 if ( proto == "mongodb" && [ "model-aggregate" ,
3545 "property-number-size" , "smart-types" ] . indexOf ( name ) >= 0 ) return false ;
0 commit comments