@@ -25,15 +25,13 @@ it.skip('sends child spans on repeated Durable Object calls', async ({ signal })
2525
2626 // All 5 child spans should be present
2727 expect ( transactionEvent . spans ) . toHaveLength ( 5 ) ;
28- expect ( transactionEvent . spans ) . toEqual (
29- expect . arrayContaining ( [
30- expect . objectContaining ( { description : 'task-1' , op : 'task' } ) ,
31- expect . objectContaining ( { description : 'task-2' , op : 'task' } ) ,
32- expect . objectContaining ( { description : 'task-3' , op : 'task' } ) ,
33- expect . objectContaining ( { description : 'task-4' , op : 'task' } ) ,
34- expect . objectContaining ( { description : 'task-5' , op : 'task' } ) ,
35- ] ) ,
36- ) ;
28+ expect ( transactionEvent . spans ) . toEqual ( [
29+ expect . objectContaining ( { description : 'task-1' , op : 'task' } ) ,
30+ expect . objectContaining ( { description : 'task-2' , op : 'task' } ) ,
31+ expect . objectContaining ( { description : 'task-3' , op : 'task' } ) ,
32+ expect . objectContaining ( { description : 'task-4' , op : 'task' } ) ,
33+ expect . objectContaining ( { description : 'task-5' , op : 'task' } ) ,
34+ ] ) ;
3735
3836 // All child spans share the root trace_id
3937 const rootTraceId = transactionEvent . contexts ?. trace ?. trace_id ;
@@ -43,23 +41,12 @@ it.skip('sends child spans on repeated Durable Object calls', async ({ signal })
4341 }
4442 }
4543
46- // Expect 5 transaction envelopes — one per call.
47- const runner = createRunner ( __dirname ) . expectN ( 5 , assertDoWorkEnvelope ) . start ( signal ) ;
48-
49- // Small delay between requests to allow waitUntil to process in wrangler dev.
50- // This is needed because wrangler dev may not guarantee waitUntil completion
51- // the same way production Cloudflare does. Without this delay, the last
52- // envelope's HTTP request may not complete before the test moves on.
53- const delay = ( ) => new Promise ( resolve => setTimeout ( resolve , 50 ) ) ;
44+ const runner = createRunner ( __dirname ) . start ( signal ) ;
5445
55- await runner . makeRequest ( 'get' , '/' ) ;
56- await delay ( ) ;
57- await runner . makeRequest ( 'get' , '/' ) ;
58- await delay ( ) ;
59- await runner . makeRequest ( 'get' , '/' ) ;
60- await delay ( ) ;
61- await runner . makeRequest ( 'get' , '/' ) ;
62- await delay ( ) ;
63- await runner . makeRequest ( 'get' , '/' ) ;
64- await runner . completed ( ) ;
46+ // Each request waits for its envelope to be received and validated before proceeding.
47+ await runner . makeRequestAndWaitForEnvelope ( 'get' , '/' , assertDoWorkEnvelope ) ;
48+ await runner . makeRequestAndWaitForEnvelope ( 'get' , '/' , assertDoWorkEnvelope ) ;
49+ await runner . makeRequestAndWaitForEnvelope ( 'get' , '/' , assertDoWorkEnvelope ) ;
50+ await runner . makeRequestAndWaitForEnvelope ( 'get' , '/' , assertDoWorkEnvelope ) ;
51+ await runner . makeRequestAndWaitForEnvelope ( 'get' , '/' , assertDoWorkEnvelope ) ;
6552} ) ;
0 commit comments