@@ -73,7 +73,10 @@ describe('Endpoints collection', () => {
73
73
{ method : 'GET' , path : '/wildcard/*' } ,
74
74
{ method : 'HEAD' , path : '/wildcard/*' } ,
75
75
{ method : 'GET' , path : '*' } ,
76
- { method : 'HEAD' , path : '*' }
76
+ { method : 'HEAD' , path : '*' } ,
77
+
78
+ { method : 'GET' , path : '/later' } ,
79
+ { method : 'HEAD' , path : '/later' } ,
77
80
]
78
81
79
82
return expectedEndpoints
@@ -85,20 +88,12 @@ describe('Endpoints collection', () => {
85
88
86
89
try {
87
90
agent = await new FakeAgent ( ) . start ( )
88
- proc = await spawnProc ( appFile , {
89
- cwd,
90
- env : {
91
- DD_TRACE_AGENT_PORT : agent . port ,
92
- DD_TELEMETRY_HEARTBEAT_INTERVAL : 1 ,
93
- DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT : '10'
94
- }
95
- } )
96
91
97
92
const expectedEndpoints = getExpectedEndpoints ( framework )
98
93
const endpointsFound = [ ]
99
94
const isFirstFlags = [ ]
100
95
101
- await agent . assertTelemetryReceived ( msg => {
96
+ const telemetryPromise = agent . assertTelemetryReceived ( msg => {
102
97
const { payload } = msg
103
98
if ( payload . request_type === 'app-endpoints' ) {
104
99
isFirstFlags . push ( Boolean ( payload . payload . is_first ) )
@@ -117,6 +112,17 @@ describe('Endpoints collection', () => {
117
112
}
118
113
} , 'app-endpoints' , 5_000 , 4 )
119
114
115
+ proc = await spawnProc ( appFile , {
116
+ cwd,
117
+ env : {
118
+ DD_TRACE_AGENT_PORT : agent . port ,
119
+ DD_TELEMETRY_HEARTBEAT_INTERVAL : 1 ,
120
+ DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT : '10'
121
+ }
122
+ } )
123
+
124
+ await telemetryPromise
125
+
120
126
const trueCount = isFirstFlags . filter ( v => v === true ) . length
121
127
expect ( trueCount ) . to . equal ( 1 )
122
128
0 commit comments