File tree 1 file changed +9
-8
lines changed
packages/react-dom/src/__tests__
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -1857,12 +1857,14 @@ describe('ReactUpdates', () => {
1857
1857
}
1858
1858
1859
1859
let error = null ;
1860
- let stack = null ;
1860
+ let ownerStack = null ;
1861
1861
let nativeStack = null ;
1862
1862
const originalConsoleError = console . error ;
1863
- console . error = ( e , s ) => {
1863
+ console . error = e => {
1864
1864
error = e ;
1865
- stack = s ;
1865
+ ownerStack = gate ( flags => flags . enableOwnerStacks )
1866
+ ? React . captureOwnerStack ( )
1867
+ : null ;
1866
1868
nativeStack = new Error ( ) . stack ;
1867
1869
Scheduler . log ( 'stop' ) ;
1868
1870
} ;
@@ -1878,12 +1880,11 @@ describe('ReactUpdates', () => {
1878
1880
expect ( error ) . toContain ( 'Maximum update depth exceeded' ) ;
1879
1881
// The currently executing effect should be on the native stack
1880
1882
expect ( nativeStack ) . toContain ( 'at myEffect' ) ;
1881
- if ( ! gate ( flags => flags . enableOwnerStacks ) ) {
1882
- // The currently running component's name is not in the owner
1883
- // stack because it's just its JSX callsite.
1884
- expect ( stack ) . toContain ( 'at NonTerminating' ) ;
1883
+ if ( gate ( flags => flags . enableOwnerStacks ) ) {
1884
+ expect ( ownerStack ) . toContain ( 'at App' ) ;
1885
+ } else {
1886
+ expect ( ownerStack ) . toBe ( null ) ;
1885
1887
}
1886
- expect ( stack ) . toContain ( 'at App' ) ;
1887
1888
} ) ;
1888
1889
1889
1890
it ( 'can have nested updates if they do not cross the limit' , async ( ) => {
You can’t perform that action at this time.
0 commit comments