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');
11
11
const inspector = require ( 'node:inspector/promises' ) ;
12
12
const dc = require ( 'diagnostics_channel' ) ;
13
13
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
+
14
16
const session = new inspector . Session ( ) ;
15
17
session . connect ( ) ;
16
18
17
19
dc . channel ( 'undici:websocket:socket_error' ) . subscribe ( ( message ) => {
18
20
console . error ( 'WebSocket error:' , message ) ;
19
21
} ) ;
20
22
21
- function findFrameInInitiator ( scriptName , initiator ) {
23
+ function findFrameInInitiator ( regex , initiator ) {
22
24
const frame = initiator . stack . callFrames . find ( ( it ) => {
23
- return it . url === scriptName ;
25
+ return regex . test ( it . url ) ;
24
26
} ) ;
25
27
return frame ;
26
28
}
@@ -39,7 +41,7 @@ async function test() {
39
41
assert . ok ( message . params . requestId ) ;
40
42
assert . strictEqual ( typeof message . params . initiator , 'object' ) ;
41
43
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 ) ) ;
43
45
requestId = message . params . requestId ;
44
46
} ) ) ;
45
47
You can’t perform that action at this time.
0 commit comments