@@ -5,6 +5,7 @@ common.skipIfInspectorDisabled();
55const { spawnSync } = require ( 'child_process' ) ;
66const { createServer } = require ( 'http' ) ;
77const assert = require ( 'assert' ) ;
8+ const tmpdir = require ( '../common/tmpdir' ) ;
89const fixtures = require ( '../common/fixtures' ) ;
910const entry = fixtures . path ( 'empty.js' ) ;
1011const { Worker } = require ( 'worker_threads' ) ;
@@ -21,10 +22,10 @@ function testOnServerListen(fn) {
2122 server . listen ( 0 , '127.0.0.1' ) ;
2223}
2324
24- function testChildProcess ( getArgs , exitCode ) {
25+ function testChildProcess ( getArgs , exitCode , options ) {
2526 testOnServerListen ( ( server ) => {
2627 const { port } = server . address ( ) ;
27- const child = spawnSync ( process . execPath , getArgs ( port ) ) ;
28+ const child = spawnSync ( process . execPath , getArgs ( port ) , options ) ;
2829 const stderr = child . stderr . toString ( ) . trim ( ) ;
2930 const stdout = child . stdout . toString ( ) . trim ( ) ;
3031 console . log ( '[STDERR]' ) ;
@@ -40,8 +41,12 @@ function testChildProcess(getArgs, exitCode) {
4041 } ) ;
4142}
4243
44+ tmpdir . refresh ( ) ;
45+
4346testChildProcess (
44- ( port ) => [ `--inspect=${ port } ` , '--build-snapshot' , entry ] , 0 ) ;
47+ ( port ) => [ `--inspect=${ port } ` , '--build-snapshot' , entry ] , 0 ,
48+ { cwd : tmpdir . path } ) ;
49+
4550testChildProcess (
4651 ( port ) => [ `--inspect=${ port } ` , entry ] , 0 ) ;
4752
0 commit comments