From d4b635808c842de01c0fdf07fe6b364edaeea598 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Mon, 5 Feb 2024 17:17:07 +0000 Subject: [PATCH] chore: use versioned render in profilerChangeDescriptions test (#28221) --- .../src/__tests__/profilerChangeDescriptions-test.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/react-devtools-shared/src/__tests__/profilerChangeDescriptions-test.js b/packages/react-devtools-shared/src/__tests__/profilerChangeDescriptions-test.js index 3536034d9f748..cf5304664b815 100644 --- a/packages/react-devtools-shared/src/__tests__/profilerChangeDescriptions-test.js +++ b/packages/react-devtools-shared/src/__tests__/profilerChangeDescriptions-test.js @@ -7,9 +7,10 @@ * @flow */ +import {getVersionedRenderImplementation} from './utils'; + describe('Profiler change descriptions', () => { let React; - let legacyRender; let store; let utils; @@ -17,8 +18,6 @@ describe('Profiler change descriptions', () => { utils = require('./utils'); utils.beforeEachProfiling(); - legacyRender = utils.legacyRender; - store = global.store; store.collapseNodesByDefault = false; store.recordChangeDescriptions = true; @@ -26,6 +25,8 @@ describe('Profiler change descriptions', () => { React = require('react'); }); + const {render} = getVersionedRenderImplementation(); + // @reactVersion >=18.0 it('should identify useContext as the cause for a re-render', () => { const Context = React.createContext(0); @@ -62,10 +63,8 @@ describe('Profiler change descriptions', () => { ); }; - const container = document.createElement('div'); - utils.act(() => store.profilerStore.startProfiling()); - utils.act(() => legacyRender(, container)); + utils.act(() => render()); utils.act(() => forceUpdate()); utils.act(() => store.profilerStore.stopProfiling());