File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ function advanceTimers(currentTime) {
9191 timer . sortIndex = timer . expirationTime ;
9292 push ( taskQueue , timer ) ;
9393 if ( enableProfiling ) {
94- markTaskStart ( timer ) ;
94+ markTaskStart ( timer , currentTime ) ;
9595 timer . isQueued = true ;
9696 }
9797 } else {
Original file line number Diff line number Diff line change @@ -483,6 +483,32 @@ Task 2 [Normal] │ ░░░░░░░░🡐 canceled
483483 ) ;
484484 } ) ;
485485
486+ it ( 'handles delayed tasks' , ( ) => {
487+ Scheduler . unstable_Profiling . startLoggingProfilingEvents ( ) ;
488+ scheduleCallback (
489+ NormalPriority ,
490+ ( ) => {
491+ Scheduler . unstable_advanceTime ( 1000 ) ;
492+ Scheduler . unstable_yieldValue ( 'A' ) ;
493+ } ,
494+ {
495+ delay : 1000 ,
496+ } ,
497+ ) ;
498+ expect ( Scheduler ) . toFlushWithoutYielding ( ) ;
499+
500+ Scheduler . unstable_advanceTime ( 1000 ) ;
501+
502+ expect ( Scheduler ) . toFlushAndYield ( [ 'A' ] ) ;
503+
504+ expect ( stopProfilingAndPrintFlamegraph ( ) ) . toEqual (
505+ `
506+ !!! Main thread │████████████████████░░░░░░░░░░░░░░░░░░░░
507+ Task 1 [Normal] │ ████████████████████
508+ ` ,
509+ ) ;
510+ } ) ;
511+
486512 it ( 'handles cancelling a delayed task' , ( ) => {
487513 Scheduler . unstable_Profiling . startLoggingProfilingEvents ( ) ;
488514 const task = scheduleCallback (
You can’t perform that action at this time.
0 commit comments