File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -11,16 +11,18 @@ const WebSocketServer = require('../common/websocket-server');
1111const  inspector  =  require ( 'node:inspector/promises' ) ; 
1212const  dc  =  require ( 'diagnostics_channel' ) ; 
1313
14+ const  nameRE  =  'undici'  in  process . versions  ? / ^ n o d e : i n t e r n a l \/ d e p s \/ u n d i c i \/ u n d i c i $ / u/ u n d i c i / u; 
15+ 
1416const  session  =  new  inspector . Session ( ) ; 
1517session . connect ( ) ; 
1618
1719dc . channel ( 'undici:websocket:socket_error' ) . subscribe ( ( message )  =>  { 
1820 console . error ( 'WebSocket error:' ,  message ) ; 
1921} ) ; 
2022
21- function  findFrameInInitiator ( scriptName ,  initiator )  { 
23+ function  findFrameInInitiator ( regex ,  initiator )  { 
2224 const  frame  =  initiator . stack . callFrames . find ( ( it )  =>  { 
23-  return  it . url   ===   scriptName ; 
25+  return  regex . test ( it . url ) ; 
2426 } ) ; 
2527 return  frame ; 
2628} 
@@ -39,7 +41,7 @@ async function test() {
3941 assert . ok ( message . params . requestId ) ; 
4042 assert . strictEqual ( typeof  message . params . initiator ,  'object' ) ; 
4143 assert . strictEqual ( message . params . initiator . type ,  'script' ) ; 
42-  assert . ok ( findFrameInInitiator ( 'node:internal/deps/undici/undici' ,  message . params . initiator ) ) ; 
44+  assert . ok ( findFrameInInitiator ( nameRE ,  message . params . initiator ) ) ; 
4345 requestId  =  message . params . requestId ; 
4446 } ) ) ; 
4547
                         You can’t perform that action at this time. 
           
                  
0 commit comments