@@ -494,6 +494,45 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
494
'.env.production.local' : 'defined in .env.production.local' ,
494
'.env.production.local' : 'defined in .env.production.local' ,
495
} )
495
} )
496
} )
496
} )
497
+
498
+ test ( 'ISR pages that are the same after regeneration execute background getStaticProps uninterrupted' , async ( {
499
+ page,
500
+ pageRouter,
501
+ } ) => {
502
+ const slug = Date . now ( )
503
+
504
+ await page . goto ( new URL ( `always-the-same-body/${ slug } ` , pageRouter . url ) . href )
505
+
506
+ await new Promise ( ( resolve ) => setTimeout ( resolve , 15_000 ) )
507
+
508
+ await page . goto ( new URL ( `always-the-same-body/${ slug } ` , pageRouter . url ) . href )
509
+
510
+ await new Promise ( ( resolve ) => setTimeout ( resolve , 15_000 ) )
511
+
512
+ await page . goto ( new URL ( `always-the-same-body/${ slug } ` , pageRouter . url ) . href )
513
+
514
+ await new Promise ( ( resolve ) => setTimeout ( resolve , 15_000 ) )
515
+
516
+ // keep lambda executing to allow for background getStaticProps to finish in case background work execution was suspended
517
+ await fetch ( new URL ( `api/sleep-5` , pageRouter . url ) . href )
518
+
519
+ const response = await fetch ( new URL ( `read-static-props-blobs/${ slug } ` , pageRouter . url ) . href )
520
+ expect ( response . ok , 'response for stored data status should not fail' ) . toBe ( true )
521
+
522
+ const data = await response . json ( )
523
+
524
+ expect ( typeof data . start , 'timestamp of getStaticProps start should be a number' ) . toEqual (
525
+ 'number' ,
526
+ )
527
+ expect ( typeof data . end , 'timestamp of getStaticProps end should be a number' ) . toEqual ( 'number' )
528
+
529
+ // duration should be around 5s overall, due to 5s timeout, but this is not exact so let's be generous and allow 10 seconds
530
+ // which is still less than 15 seconds between requests
531
+ expect (
532
+ data . end - data . start ,
533
+ 'getStaticProps duration should not be longer than 10 seconds' ,
534
+ ) . toBeLessThan ( 10_000 )
535
+ } )
497
} )
536
} )
498
537
499
test . describe ( 'Page Router with basePath and i18n' , ( ) => {
538
test . describe ( 'Page Router with basePath and i18n' , ( ) => {
0 commit comments