@@ -9,8 +9,7 @@ const TYPES = require('../../src/data-type').typeByName;
99import Connection from '../../src/connection' ;
1010import { RequestError } from '../../src/errors' ;
1111import Request from '../../src/request' ;
12-
13- const debugMode = false ;
12+ import { debugOptionsFromEnv } from '../helpers/debug-options-from-env' ;
1413
1514function getConfig ( ) {
1615 const { config } = JSON . parse (
@@ -21,14 +20,7 @@ function getConfig() {
2120
2221 config . options . cancelTimeout = 1000 ;
2322
24- if ( debugMode ) {
25- config . options . debug = {
26- packet : true ,
27- data : true ,
28- payload : true ,
29- token : true
30- } ;
31- }
23+ config . options . debug = debugOptionsFromEnv ( ) ;
3224
3325 return config ;
3426}
@@ -43,14 +35,14 @@ describe('BulkLoad', function() {
4335 connection = new Connection ( getConfig ( ) ) ;
4436 connection . connect ( done ) ;
4537
46- if ( debugMode ) {
38+ if ( process . env . TEDIOUS_DEBUG ) {
4739 connection . on ( 'debug' , ( message ) => console . log ( message ) ) ;
48- connection . on ( 'infoMessage' , ( info ) =>
49- console . log ( 'Info: ' + info . number + ' - ' + info . message )
50- ) ;
51- connection . on ( 'errorMessage' , ( error ) =>
52- console . log ( 'Error: ' + error . number + ' - ' + error . message )
53- ) ;
40+ connection . on ( 'infoMessage' , ( info ) => {
41+ console . log ( 'Info: ' + info . number + ' - ' + info . message ) ;
42+ } ) ;
43+ connection . on ( 'errorMessage' , ( error ) => {
44+ console . log ( 'Error: ' + error . number + ' - ' + error . message ) ;
45+ } ) ;
5446 }
5547 } ) ;
5648
0 commit comments