@@ -72,7 +72,7 @@ function findTestFile(servicePath) {
72
72
* @param {string } bindPath
73
73
* @return {boolean }
74
74
*/
75
- function tryBindPath ( serverless , bindPath , testFile ) {
75
+ function tryBindPath ( bindPath , testFile , { serverless , log } ) {
76
76
const debug = process . env . SLS_DEBUG ;
77
77
const options = [
78
78
'run' ,
@@ -84,12 +84,30 @@ function tryBindPath(serverless, bindPath, testFile) {
84
84
`/test/${ testFile } ` ,
85
85
] ;
86
86
try {
87
- if ( debug ) serverless . cli . log ( `Trying bindPath ${ bindPath } (${ options } )` ) ;
87
+ if ( debug ) {
88
+ if ( log ) {
89
+ log . debug ( `Trying bindPath ${ bindPath } (${ options } )` ) ;
90
+ } else {
91
+ serverless . cli . log ( `Trying bindPath ${ bindPath } (${ options } )` ) ;
92
+ }
93
+ }
88
94
const ps = dockerCommand ( options ) ;
89
- if ( debug ) serverless . cli . log ( ps . stdout . trim ( ) ) ;
95
+ if ( debug ) {
96
+ if ( log ) {
97
+ log . debug ( ps . stdout . trim ( ) ) ;
98
+ } else {
99
+ serverless . cli . log ( ps . stdout . trim ( ) ) ;
100
+ }
101
+ }
90
102
return ps . stdout . trim ( ) === `/test/${ testFile } ` ;
91
103
} catch ( err ) {
92
- if ( debug ) serverless . cli . log ( `Finding bindPath failed with ${ err } ` ) ;
104
+ if ( debug ) {
105
+ if ( log ) {
106
+ log . debug ( `Finding bindPath failed with ${ err } ` ) ;
107
+ } else {
108
+ serverless . cli . log ( `Finding bindPath failed with ${ err } ` ) ;
109
+ }
110
+ }
93
111
return false ;
94
112
}
95
113
}
@@ -100,7 +118,7 @@ function tryBindPath(serverless, bindPath, testFile) {
100
118
* @param {string } servicePath
101
119
* @return {string } The bind path.
102
120
*/
103
- function getBindPath ( serverless , servicePath ) {
121
+ function getBindPath ( servicePath , pluginInstance ) {
104
122
// Determine bind path
105
123
if ( process . platform !== 'win32' && ! isWsl ) {
106
124
return servicePath ;
@@ -144,7 +162,7 @@ function getBindPath(serverless, servicePath) {
144
162
145
163
for ( let i = 0 ; i < bindPaths . length ; i ++ ) {
146
164
const bindPath = bindPaths [ i ] ;
147
- if ( tryBindPath ( serverless , bindPath , testFile ) ) {
165
+ if ( tryBindPath ( bindPath , testFile , pluginInstance ) ) {
148
166
return bindPath ;
149
167
}
150
168
}
0 commit comments