77 * @flow
88 */
99
10- import { normalizeCodeLocInfo } from './utils' ;
10+ import { getVersionedRenderImplementation , normalizeCodeLocInfo } from './utils' ;
1111
1212describe ( 'component stack' , ( ) => {
1313 let React ;
1414 let act ;
15- let legacyRender ;
1615 let mockError ;
1716 let mockWarn ;
1817
@@ -30,11 +29,12 @@ describe('component stack', () => {
3029
3130 const utils = require ( './utils' ) ;
3231 act = utils . act ;
33- legacyRender = utils . legacyRender ;
3432
3533 React = require ( 'react' ) ;
3634 } ) ;
3735
36+ const { render} = getVersionedRenderImplementation ( ) ;
37+
3838 // @reactVersion >=16.9
3939 it ( 'should log the current component stack along with an error or warning' , ( ) => {
4040 const Grandparent = ( ) => < Parent /> ;
@@ -45,9 +45,7 @@ describe('component stack', () => {
4545 return null ;
4646 } ;
4747
48- const container = document . createElement ( 'div' ) ;
49-
50- act ( ( ) => legacyRender ( < Grandparent /> , container ) ) ;
48+ act ( ( ) => render ( < Grandparent /> ) ) ;
5149
5250 expect ( mockError ) . toHaveBeenCalledWith (
5351 'Test error.' ,
@@ -79,8 +77,7 @@ describe('component stack', () => {
7977 return null ;
8078 } ;
8179
82- const container = document . createElement ( 'div' ) ;
83- act ( ( ) => legacyRender ( < Example test = "abc" /> , container ) ) ;
80+ act ( ( ) => render ( < Example test = "abc" /> ) ) ;
8481
8582 expect ( useEffectCount ) . toBe ( 1 ) ;
8683
0 commit comments