@@ -10,8 +10,6 @@ import { writeFileSync, readFileSync } from 'node:fs';
10
10
import { inspect } from 'node:util' ;
11
11
import { once } from 'node:events' ;
12
12
import { setTimeout } from 'node:timers/promises' ;
13
- import { NodeInstance } from '../common/inspector-helper.js' ;
14
-
15
13
16
14
if ( common . isIBMi )
17
15
common . skip ( 'IBMi does not support `fs.watch()`' ) ;
@@ -236,67 +234,4 @@ describe('watch mode', { concurrency: false, timeout: 60_0000 }, () => {
236
234
`Completed running ${ inspect ( file ) } ` , `Restarting ${ inspect ( file ) } ` , `Completed running ${ inspect ( file ) } ` , '' ,
237
235
] . join ( '\n' ) ) ;
238
236
} ) ;
239
-
240
- describe ( 'inspect' , {
241
- skip : Boolean ( process . config . variables . coverage || ! process . features . inspector ) ,
242
- } , ( ) => {
243
- const silentLogger = { log : ( ) => { } , error : ( ) => { } } ;
244
- async function getDebuggedPid ( instance , waitForLog = true ) {
245
- const session = await instance . connectInspectorSession ( ) ;
246
- await session . send ( { method : 'Runtime.enable' } ) ;
247
- if ( waitForLog ) {
248
- await session . waitForConsoleOutput ( 'log' , 'safe to debug now' ) ;
249
- }
250
- const { value : innerPid } = ( await session . send ( {
251
- 'method' : 'Runtime.evaluate' , 'params' : { 'expression' : 'process.pid' }
252
- } ) ) . result ;
253
- session . disconnect ( ) ;
254
- return innerPid ;
255
- }
256
-
257
- it ( 'should start debugger on inner process' , async ( ) => {
258
- const file = fixtures . path ( 'watch-mode/inspect.js' ) ;
259
- const instance = new NodeInstance ( [ '--inspect=0' , '--watch' ] , undefined , file , silentLogger ) ;
260
- let stderr = '' ;
261
- instance . on ( 'stderr' , ( data ) => { stderr += data ; } ) ;
262
-
263
- const pids = [ instance . pid ] ;
264
- pids . push ( await getDebuggedPid ( instance ) ) ;
265
- instance . resetPort ( ) ;
266
- writeFileSync ( file , readFileSync ( file ) ) ;
267
- pids . push ( await getDebuggedPid ( instance ) ) ;
268
-
269
- await instance . kill ( ) ;
270
-
271
- // There should be 3 pids (one parent + 2 restarts).
272
- // Message about Debugger should only appear twice.
273
- assert . strictEqual ( stderr . match ( / D e b u g g e r l i s t e n i n g o n w s : \/ \/ / g) . length , 2 ) ;
274
- assert . strictEqual ( new Set ( pids ) . size , 3 ) ;
275
- } ) ;
276
-
277
- it ( 'should prevent attaching debugger with SIGUSR1 to outer process' , { skip : common . isWindows } , async ( ) => {
278
- const file = fixtures . path ( 'watch-mode/inspect_with_signal.js' ) ;
279
- const instance = new NodeInstance ( [ '--inspect-port=0' , '--watch' ] , undefined , file , silentLogger ) ;
280
- let stderr = '' ;
281
- instance . on ( 'stderr' , ( data ) => { stderr += data ; } ) ;
282
-
283
- const loggedPid = await new Promise ( ( resolve ) => {
284
- instance . on ( 'stdout' , ( data ) => {
285
- const matches = data . match ( / p i d i s ( \d + ) / ) ;
286
- if ( matches ) resolve ( Number ( matches [ 1 ] ) ) ;
287
- } ) ;
288
- } ) ;
289
-
290
-
291
- process . kill ( instance . pid , 'SIGUSR1' ) ;
292
- process . kill ( loggedPid , 'SIGUSR1' ) ;
293
- const debuggedPid = await getDebuggedPid ( instance , false ) ;
294
-
295
- await instance . kill ( ) ;
296
-
297
- // Message about Debugger should only appear once in inner process.
298
- assert . strictEqual ( stderr . match ( / D e b u g g e r l i s t e n i n g o n w s : \/ \/ / g) . length , 1 ) ;
299
- assert . strictEqual ( loggedPid , debuggedPid ) ;
300
- } ) ;
301
- } ) ;
302
237
} ) ;
0 commit comments