@@ -62,7 +62,7 @@ async function runWriteSucceed({
62
62
child . kill ( ) ;
63
63
cancelRestarts ( ) ;
64
64
}
65
- return { stdout, stderr } ;
65
+ return { stdout, stderr, pid : child . pid } ;
66
66
}
67
67
68
68
async function failWriteSucceed ( { file, watchedFile } ) {
@@ -259,13 +259,14 @@ console.log(values.random);
259
259
] ) ;
260
260
} ) ;
261
261
262
- it ( 'should not load --require modules in main process' , async ( ) => {
262
+ it ( 'should load --require modules in the watched process, and not in the orchestrator process' , async ( ) => {
263
263
const file = createTmpFile ( ) ;
264
- const required = createTmpFile ( 'setImmediate(() => process.exit(0) );' ) ;
264
+ const required = createTmpFile ( 'process._rawDebug(\'pid\', process.pid );' ) ;
265
265
const args = [ '--require' , required , file ] ;
266
- const { stderr , stdout } = await runWriteSucceed ( { file, watchedFile : file , args } ) ;
266
+ const { stdout , pid } = await runWriteSucceed ( { file, watchedFile : file , args } ) ;
267
267
268
- assert . strictEqual ( stderr , '' ) ;
268
+ const importPid = parseInt ( stdout [ 0 ] . split ( ' ' ) [ 1 ] , 10 ) ;
269
+ assert . notStrictEqual ( pid , importPid ) ;
269
270
assert . deepStrictEqual ( stdout , [
270
271
'running' ,
271
272
`Completed running ${ inspect ( file ) } ` ,
@@ -275,13 +276,14 @@ console.log(values.random);
275
276
] ) ;
276
277
} ) ;
277
278
278
- it ( 'should not load --import modules in main process' , async ( ) => {
279
+ it ( 'should load --import modules in the watched process, and not in the orchestrator process' , async ( ) => {
279
280
const file = createTmpFile ( ) ;
280
- const imported = pathToFileURL ( createTmpFile ( ' process._rawDebug("imported");' ) ) ;
281
+ const imported = "data:text/javascript, process._rawDebug('pid', process.pid);" ;
281
282
const args = [ '--import' , imported , file ] ;
282
- const { stderr , stdout } = await runWriteSucceed ( { file, watchedFile : file , args } ) ;
283
+ const { stdout , pid } = await runWriteSucceed ( { file, watchedFile : file , args } ) ;
283
284
284
- assert . strictEqual ( stderr , 'imported\nimported\n' ) ;
285
+ const importPid = parseInt ( stdout [ 0 ] . split ( ' ' ) [ 1 ] , 10 ) ;
286
+ assert . notStrictEqual ( pid , importPid ) ;
285
287
assert . deepStrictEqual ( stdout , [
286
288
'running' ,
287
289
`Completed running ${ inspect ( file ) } ` ,
0 commit comments