chore: use versioned render in profilingCharts test (#28235)
Ruslan Lesiutin committed
Feb 5, 2024 at 17:18 UTC
e6979aa14299f8119bbe858d767e71b88c4c8f64
1 file changed
+8
-11
packages/react-devtools-shared/src/__tests__/profilingCharts-test.js
+8
-11
@@ -9,10 +9,11 @@
9
10
import type Store from 'react-devtools-shared/src/devtools/store';
11
12
+import {getVersionedRenderImplementation} from './utils';
13
+
14
describe('profiling charts', () => {
15
let React;
16
let Scheduler;
15
- let legacyRender;
17
let store: Store;
18
let utils;
19
@@ -20,8 +21,6 @@ describe('profiling charts', () => {
21
utils = require('./utils');
22
utils.beforeEachProfiling();
23
23
- legacyRender = utils.legacyRender;
24
-
24
store = global.store;
25
store.collapseNodesByDefault = false;
26
store.recordChangeDescriptions = true;
@@ -30,6 +29,8 @@ describe('profiling charts', () => {
29
Scheduler = require('scheduler');
30
});
31
32
+ const {render} = getVersionedRenderImplementation();
33
+
34
function getFlamegraphChartData(rootID, commitIndex) {
35
const commitTree = store.profilerStore.profilingCache.getCommitTree({
36
commitIndex,
@@ -78,11 +79,9 @@ describe('profiling charts', () => {
79
return null;
80
});
81
81
- const container = document.createElement('div');
82
-
82
utils.act(() => store.profilerStore.startProfiling());
83
85
- utils.act(() => legacyRender(<Parent />, container));
84
+ utils.act(() => render(<Parent />));
85
expect(store).toMatchInlineSnapshot(`
86
[root]
87
▾ <Parent>
@@ -91,7 +90,7 @@ describe('profiling charts', () => {
90
<Child key="third"> [Memo]
91
`);
92
94
- utils.act(() => legacyRender(<Parent />, container));
93
+ utils.act(() => render(<Parent />));
94
expect(store).toMatchInlineSnapshot(`
95
[root]
96
▾ <Parent>
@@ -228,11 +227,9 @@ describe('profiling charts', () => {
227
return null;
228
});
229
231
- const container = document.createElement('div');
232
-
230
utils.act(() => store.profilerStore.startProfiling());
231
235
- utils.act(() => legacyRender(<Parent />, container));
232
+ utils.act(() => render(<Parent />));
233
expect(store).toMatchInlineSnapshot(`
234
[root]
235
▾ <Parent>
@@ -241,7 +238,7 @@ describe('profiling charts', () => {
238
<Child key="third"> [Memo]
239
`);
240
244
- utils.act(() => legacyRender(<Parent />, container));
241
+ utils.act(() => render(<Parent />));
242
expect(store).toMatchInlineSnapshot(`
243
[root]
244
▾ <Parent>