@@ -715,4 +715,143 @@ describe('SchedulingProfiler', () => {
715715    ` ) ; 
716716    } 
717717  } ) ; 
718+ 
719+   it ( 'should mark sync render that throws' ,  async  ( )  =>  { 
720+     class  ErrorBoundary  extends  React . Component  { 
721+       state  =  { error : null } ; 
722+       componentDidCatch ( error )  { 
723+         this . setState ( { error} ) ; 
724+       } 
725+       render ( )  { 
726+         if  ( this . state . error )  { 
727+           return  null ; 
728+         } 
729+         return  this . props . children ; 
730+       } 
731+     } 
732+ 
733+     function  ExampleThatThrows ( )  { 
734+       throw  Error ( 'Expected error' ) ; 
735+     } 
736+ 
737+     ReactTestRenderer . create ( 
738+       < ErrorBoundary > 
739+         < ExampleThatThrows  /> 
740+       </ ErrorBoundary > , 
741+     ) ; 
742+ 
743+     if  ( gate ( flags  =>  flags . enableSchedulingProfiler ) )  { 
744+       expect ( getMarks ( ) ) . toMatchInlineSnapshot ( ` 
745+       Array [ 
746+         "--schedule-render-1", 
747+         "--render-start-1", 
748+         "--component-render-start-ErrorBoundary", 
749+         "--component-render-stop", 
750+         "--component-render-start-ExampleThatThrows", 
751+         "--component-render-start-ExampleThatThrows", 
752+         "--component-render-stop", 
753+         "--error-ExampleThatThrows-mount-Expected error", 
754+         "--render-stop", 
755+         "--commit-start-1", 
756+         "--react-version-17.0.3", 
757+         "--profiler-version-1", 
758+         "--react-lane-labels-Sync,InputContinuousHydration,InputContinuous,DefaultHydration,Default,TransitionHydration,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Retry,Retry,Retry,Retry,Retry,SelectiveHydration,IdleHydration,Idle,Offscreen", 
759+         "--layout-effects-start-1", 
760+         "--schedule-state-update-1-ErrorBoundary", 
761+         "--layout-effects-stop", 
762+         "--commit-stop", 
763+         "--render-start-1", 
764+         "--component-render-start-ErrorBoundary", 
765+         "--component-render-stop", 
766+         "--render-stop", 
767+         "--commit-start-1", 
768+         "--react-version-17.0.3", 
769+         "--profiler-version-1", 
770+         "--react-lane-labels-Sync,InputContinuousHydration,InputContinuous,DefaultHydration,Default,TransitionHydration,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Retry,Retry,Retry,Retry,Retry,SelectiveHydration,IdleHydration,Idle,Offscreen", 
771+         "--commit-stop", 
772+       ] 
773+     ` ) ; 
774+     } 
775+   } ) ; 
776+ 
777+   it ( 'should mark concurrent render that throws' ,  async  ( )  =>  { 
778+     spyOnProd ( console ,  'error' ) ; 
779+ 
780+     class  ErrorBoundary  extends  React . Component  { 
781+       state  =  { error : null } ; 
782+       componentDidCatch ( error )  { 
783+         this . setState ( { error} ) ; 
784+       } 
785+       render ( )  { 
786+         if  ( this . state . error )  { 
787+           return  null ; 
788+         } 
789+         return  this . props . children ; 
790+       } 
791+     } 
792+ 
793+     function  ExampleThatThrows ( )  { 
794+       // eslint-disable-next-line no-throw-literal 
795+       throw  'Expected error' ; 
796+     } 
797+ 
798+     ReactTestRenderer . create ( 
799+       < ErrorBoundary > 
800+         < ExampleThatThrows  /> 
801+       </ ErrorBoundary > , 
802+       { unstable_isConcurrent : true } , 
803+     ) ; 
804+ 
805+     if  ( gate ( flags  =>  flags . enableSchedulingProfiler ) )  { 
806+       expect ( getMarks ( ) ) . toMatchInlineSnapshot ( ` 
807+       Array [ 
808+         "--schedule-render-16", 
809+       ] 
810+     ` ) ; 
811+     } 
812+ 
813+     clearPendingMarks ( ) ; 
814+ 
815+     expect ( Scheduler ) . toFlushUntilNextPaint ( [ ] ) ; 
816+ 
817+     if  ( gate ( flags  =>  flags . enableSchedulingProfiler ) )  { 
818+       expect ( getMarks ( ) ) . toMatchInlineSnapshot ( ` 
819+         Array [ 
820+           "--render-start-16", 
821+           "--component-render-start-ErrorBoundary", 
822+           "--component-render-stop", 
823+           "--component-render-start-ExampleThatThrows", 
824+           "--component-render-start-ExampleThatThrows", 
825+           "--component-render-stop", 
826+           "--error-ExampleThatThrows-mount-Expected error", 
827+           "--render-stop", 
828+           "--render-start-16", 
829+           "--component-render-start-ErrorBoundary", 
830+           "--component-render-stop", 
831+           "--component-render-start-ExampleThatThrows", 
832+           "--component-render-start-ExampleThatThrows", 
833+           "--component-render-stop", 
834+           "--error-ExampleThatThrows-mount-Expected error", 
835+           "--render-stop", 
836+           "--commit-start-16", 
837+           "--react-version-17.0.3", 
838+           "--profiler-version-1", 
839+           "--react-lane-labels-Sync,InputContinuousHydration,InputContinuous,DefaultHydration,Default,TransitionHydration,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Retry,Retry,Retry,Retry,Retry,SelectiveHydration,IdleHydration,Idle,Offscreen", 
840+           "--layout-effects-start-16", 
841+           "--schedule-state-update-1-ErrorBoundary", 
842+           "--layout-effects-stop", 
843+           "--render-start-1", 
844+           "--component-render-start-ErrorBoundary", 
845+           "--component-render-stop", 
846+           "--render-stop", 
847+           "--commit-start-1", 
848+           "--react-version-17.0.3", 
849+           "--profiler-version-1", 
850+           "--react-lane-labels-Sync,InputContinuousHydration,InputContinuous,DefaultHydration,Default,TransitionHydration,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Retry,Retry,Retry,Retry,Retry,SelectiveHydration,IdleHydration,Idle,Offscreen", 
851+           "--commit-stop", 
852+           "--commit-stop", 
853+         ] 
854+       ` ) ; 
855+     } 
856+   } ) ; 
718857} ) ; 
0 commit comments