@@ -5,6 +5,7 @@ common.skipIfInspectorDisabled();
5
5
const { spawnSync } = require ( 'child_process' ) ;
6
6
const { createServer } = require ( 'http' ) ;
7
7
const assert = require ( 'assert' ) ;
8
+ const tmpdir = require ( '../common/tmpdir' ) ;
8
9
const fixtures = require ( '../common/fixtures' ) ;
9
10
const entry = fixtures . path ( 'empty.js' ) ;
10
11
const { Worker } = require ( 'worker_threads' ) ;
@@ -21,10 +22,10 @@ function testOnServerListen(fn) {
21
22
server . listen ( 0 , '127.0.0.1' ) ;
22
23
}
23
24
24
- function testChildProcess ( getArgs , exitCode ) {
25
+ function testChildProcess ( getArgs , exitCode , options ) {
25
26
testOnServerListen ( ( server ) => {
26
27
const { port } = server . address ( ) ;
27
- const child = spawnSync ( process . execPath , getArgs ( port ) ) ;
28
+ const child = spawnSync ( process . execPath , getArgs ( port ) , options ) ;
28
29
const stderr = child . stderr . toString ( ) . trim ( ) ;
29
30
const stdout = child . stdout . toString ( ) . trim ( ) ;
30
31
console . log ( '[STDERR]' ) ;
@@ -40,8 +41,12 @@ function testChildProcess(getArgs, exitCode) {
40
41
} ) ;
41
42
}
42
43
44
+ tmpdir . refresh ( ) ;
45
+
43
46
testChildProcess (
44
- ( port ) => [ `--inspect=${ port } ` , '--build-snapshot' , entry ] , 0 ) ;
47
+ ( port ) => [ `--inspect=${ port } ` , '--build-snapshot' , entry ] , 0 ,
48
+ { cwd : tmpdir . path } ) ;
49
+
45
50
testChildProcess (
46
51
( port ) => [ `--inspect=${ port } ` , entry ] , 0 ) ;
47
52
0 commit comments