@@ -238,7 +238,7 @@ if (testCases.length > 0) {
238
238
NODE_PATH : resolve ( join ( tempDir , "node_modules" ) ) ,
239
239
}
240
240
) ;
241
- console . log ( installStdout ) ;
241
+ debug ( installStdout ) ;
242
242
if ( installStderr ) console . error ( installStderr ) ;
243
243
} ) ( ) ,
244
244
wantInstallationError ? "does not install dependencies" : "installs dependencies"
@@ -260,7 +260,7 @@ if (testCases.length > 0) {
260
260
NODE_PATH : resolve ( join ( tempDir , "node_modules" ) ) ,
261
261
} ,
262
262
} ) ;
263
- console . log ( stdout ) ;
263
+ debug ( stdout ) ;
264
264
if ( stderr ) console . error ( stderr ) ;
265
265
} ) ( ) ,
266
266
wantWorkerError ? "worker does not start" : "worker starts"
@@ -282,23 +282,29 @@ if (testCases.length > 0) {
282
282
throw new Error ( "Nothing to test" ) ;
283
283
}
284
284
285
+ function debug ( message : string ) {
286
+ if ( options . logLevel === "debug" ) {
287
+ console . log ( message ) ;
288
+ }
289
+ }
290
+
285
291
async function installFixtureDeps ( dir : string , packageManager : PackageManager ) {
286
292
if ( [ "pnpm" , "yarn" ] . includes ( packageManager ) ) {
287
293
const buffer = readFileSync ( resolve ( join ( dir , "package.json" ) ) , "utf8" ) ;
288
294
const pkgJSON = JSON . parse ( buffer . toString ( ) ) ;
289
295
const version = pkgJSON . engines [ packageManager ] ;
290
- console . log ( `Detected ${ packageManager } @${ version } from package.json 'engines' field` ) ;
296
+ debug ( `Detected ${ packageManager } @${ version } from package.json 'engines' field` ) ;
291
297
const { stdout, stderr } = await execa ( "corepack" , [ "use" , `${ packageManager } @${ version } ` ] , {
292
298
cwd : dir ,
293
299
} ) ;
294
- console . log ( stdout ) ;
300
+ debug ( stdout ) ;
295
301
if ( stderr ) console . error ( stderr ) ;
296
302
} else {
297
303
const { stdout, stderr } = await execa ( packageManager , installArgs ( packageManager ) , {
298
304
cwd : dir ,
299
305
NODE_PATH : resolve ( join ( dir , "node_modules" ) ) ,
300
306
} ) ;
301
- console . log ( stdout ) ;
307
+ debug ( stdout ) ;
302
308
if ( stderr ) console . error ( stderr ) ;
303
309
}
304
310
}
0 commit comments