@@ -30,6 +30,7 @@ const options = {
30
30
user : login . user ,
31
31
pass : login . pass ,
32
32
idle_timeout : 0.2 ,
33
+ debug : true ,
33
34
max : 1
34
35
}
35
36
@@ -891,6 +892,7 @@ t('numeric is returned as string', async() => [
891
892
] )
892
893
893
894
t ( 'Async stack trace' , async ( ) => {
895
+ const sql = postgres ( { ...options , debug : false } )
894
896
return [
895
897
parseInt ( new Error ( ) . stack . split ( '\n' ) [ 1 ] . split ( ':' ) [ 1 ] ) + 1 ,
896
898
parseInt ( await sql `select.sql` . catch ( x => x . stack . split ( '\n' ) . pop ( ) . split ( ':' ) [ 1 ] ) )
@@ -924,15 +926,31 @@ t('Error contains query parameters', async() => [
924
926
( await sql `selec ${ 1 } ` . catch ( err => err . parameters [ 0 ] . value ) )
925
927
] )
926
928
927
- t ( 'Query string is not enumerable' , async ( ) => [
929
+ t ( 'Query string is not enumerable' , async ( ) => {
930
+ const sql = postgres ( { ...options , debug : false } )
931
+ return [
928
932
- 1 ,
929
933
( await sql `selec 1` . catch ( err => Object . keys ( err ) . indexOf ( 'query' ) ) )
930
- ] )
934
+ ]
935
+ } )
931
936
932
- t ( 'Query parameters are not enumerable' , async ( ) => [
933
- - 1 ,
934
- ( await sql `selec ${ 1 } ` . catch ( err => Object . keys ( err ) . indexOf ( 'parameters' ) ) )
935
- ] )
937
+ t ( 'Query and parameters are not enumerable if debug is not set' , async ( ) => {
938
+ const sql = postgres ( { ...options , debug : false } )
939
+
940
+ return [
941
+ false ,
942
+ ( await sql `selec ${ 1 } ` . catch ( err => err . propertyIsEnumerable ( 'parameters' ) || err . propertyIsEnumerable ( 'query' ) ) )
943
+ ]
944
+ } )
945
+
946
+ t ( 'Query and parameters are enumerable if debug is set' , async ( ) => {
947
+ const sql = postgres ( { ...options , debug : true } )
948
+
949
+ return [
950
+ true ,
951
+ ( await sql `selec ${ 1 } ` . catch ( err => err . propertyIsEnumerable ( 'parameters' ) && err . propertyIsEnumerable ( 'query' ) ) )
952
+ ]
953
+ } )
936
954
937
955
t ( 'connect_timeout throws proper error' , async ( ) => [
938
956
'CONNECT_TIMEOUT' ,
0 commit comments