File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,13 @@ port=5432
7
7
database =postgres
8
8
verbose =false
9
9
10
+ test-connection :
11
+ @node script/test-connection.js -u $(user ) --password $(password ) -p $(port ) -d $(database ) -h $(host ) --verbose $(verbose )
12
+
10
13
test-unit :
11
14
@find test/unit -name " *-tests.js" | xargs -n 1 -I file node file --verbose $(verbose )
12
15
13
- test-integration :
16
+ test-integration : test-connection
14
17
@find test/integration -name " *-tests.js" | xargs -n 1 -I file node file -u $(user ) --password $(password ) -p $(port ) -d $(database ) -h $(host ) --verbose $(verbose )
15
18
16
19
test-all : test-unit test-integration
Original file line number Diff line number Diff line change
1
+ var helper = require ( __dirname + '/../test/test-helper' ) ;
2
+ var connectionString = helper . connectionString ( ) ;
3
+ console . log ( ) ;
4
+ console . log ( "testing ability to connect to '%s'" , connectionString ) ;
5
+ var pg = require ( __dirname + '/../lib' ) ;
6
+ pg . connect ( connectionString , function ( err , client ) {
7
+ if ( err !== null ) {
8
+ console . error ( "Recieved connection error when attempting to contact PostgreSQL:" ) ;
9
+ console . error ( err ) ;
10
+ process . exit ( 255 ) ;
11
+ }
12
+ console . log ( "Checking for existance of required test table 'person'" )
13
+ client . query ( "SELECT COUNT(name) FROM person" , function ( err , callback ) {
14
+ if ( err != null ) {
15
+ console . error ( "Recieved error when executing query 'SELECT COUNT(name) FROM person'" )
16
+ console . error ( "It is possible you have not yet run the table create script under script/create-test-tables" )
17
+ console . error ( "Consult the postgres-node wiki under the 'Testing' section for more information" )
18
+ console . error ( err ) ;
19
+ process . exit ( 255 ) ;
20
+ }
21
+ pg . end ( ) ;
22
+ } )
23
+ } )
Original file line number Diff line number Diff line change 1
1
var helper = require ( __dirname + '/../test-helper' ) ;
2
2
//export parent helper stuffs
3
3
module . exports = helper ;
4
+
5
+ if ( helper . args . verbose ) {
6
+ }
You can’t perform that action at this time.
0 commit comments