Skip to content

Commit 1cbf7d1

Browse files
committed
chore: use versioned render in componentStacks test
1 parent e51cda5 commit 1cbf7d1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/react-devtools-shared/src/__tests__/componentStacks-test.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
* @flow
88
*/
99

10-
import {normalizeCodeLocInfo} from './utils';
10+
import {getVersionedRenderImplementation, normalizeCodeLocInfo} from './utils';
1111

1212
describe('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

Comments
 (0)