@@ -10,22 +10,19 @@ const assert = require('assert');
10
10
const fixtures = require ( '../common/fixtures' ) ;
11
11
const { NodeInstance } = require ( '../common/inspector-helper.js' ) ;
12
12
13
- async function runIfWaitingForDebugger ( session ) {
14
- const commands = [
15
- { 'method' : 'Runtime.enable' } ,
16
- { 'method' : 'Debugger.enable' } ,
17
- { 'method' : 'Runtime.runIfWaitingForDebugger' } ,
18
- ] ;
19
-
20
- await session . send ( commands ) ;
21
- }
22
-
23
13
async function runTest ( ) {
24
14
const main = fixtures . path ( 'es-module-loaders' , 'register-loader.mjs' ) ;
25
15
const child = new NodeInstance ( [ '--inspect-wait=0' ] , '' , main ) ;
26
16
27
17
const session = await child . connectInspectorSession ( ) ;
28
- await runIfWaitingForDebugger ( session ) ;
18
+ await session . send ( { method : 'NodeRuntime.enable' } ) ;
19
+ await session . waitForNotification ( 'NodeRuntime.waitingForDebugger' ) ;
20
+ await session . send ( [
21
+ { 'method' : 'Runtime.enable' } ,
22
+ { 'method' : 'Debugger.enable' } ,
23
+ { 'method' : 'Runtime.runIfWaitingForDebugger' } ,
24
+ ] ) ;
25
+ await session . send ( { method : 'NodeRuntime.disable' } ) ;
29
26
await session . waitForDisconnect ( ) ;
30
27
assert . strictEqual ( ( await child . expectShutdown ( ) ) . exitCode , 0 ) ;
31
28
}
0 commit comments