@@ -26,10 +26,12 @@ describe('Plugin', () => {
26
26
}
27
27
28
28
beforeEach ( ( ) => {
29
+ console . log ( 'BE' )
29
30
appListener = null
30
31
} )
31
32
32
33
afterEach ( ( ) => {
34
+ console . log ( 'AE' )
33
35
if ( appListener ) {
34
36
appListener . close ( )
35
37
}
@@ -38,10 +40,12 @@ describe('Plugin', () => {
38
40
39
41
describe ( 'without configuration' , ( ) => {
40
42
beforeEach ( async ( ) => {
43
+ console . log ( 'BEE' )
41
44
return await agent . load ( 'undici' , {
42
45
service : 'test'
43
46
} )
44
47
. then ( ( ) => {
48
+ console . log ( 'BEEX' )
45
49
express = require ( 'express' )
46
50
fetch = require ( 'undici' )
47
51
} )
@@ -68,8 +72,10 @@ describe('Plugin', () => {
68
72
res . status ( 200 ) . send ( )
69
73
} )
70
74
getPort ( ) . then ( port => {
71
- agent
75
+ console . log ( 'GOT A PORT' , port )
76
+ const p = agent
72
77
. use ( traces => {
78
+ console . log ( 'AGENT USING TRACE' )
73
79
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , 'test' )
74
80
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'type' , 'http' )
75
81
expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'resource' , 'GET' )
@@ -79,12 +85,19 @@ describe('Plugin', () => {
79
85
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'http.status_code' , '200' )
80
86
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'component' , 'undici' )
81
87
expect ( traces [ 0 ] [ 0 ] . meta ) . to . have . property ( 'out.host' , 'localhost' )
88
+ done ( )
82
89
} )
83
90
84
91
appListener = server ( app , port , ( ) => {
85
- fetch . fetch ( `http://localhost:${ port } /user` , { method : 'GET' } )
92
+ console . log ( 'SERVER READY' )
93
+ setTimeout ( ( ) => {
94
+ console . log ( 'DELAY FETCH' )
95
+ fetch . fetch ( `http://localhost:${ port } /user` , { method : 'GET' } )
96
+ } , 100 )
86
97
} )
87
- setTimeout ( done , 100 )
98
+
99
+ console . log ( 'RETURNING' )
100
+ return p
88
101
} )
89
102
} )
90
103
it ( 'should support URL input' , done => {
0 commit comments