From 7e77e29ca93857b68bfc31bcd5cd566b33b7cd15 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Mon, 5 Feb 2024 17:14:00 +0000 Subject: [PATCH] chore: use versioned render in componentStacks test (#28214) --- .../src/__tests__/componentStacks-test.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/react-devtools-shared/src/__tests__/componentStacks-test.js b/packages/react-devtools-shared/src/__tests__/componentStacks-test.js index 401af1d9c5546..3f3ce3774332e 100644 --- a/packages/react-devtools-shared/src/__tests__/componentStacks-test.js +++ b/packages/react-devtools-shared/src/__tests__/componentStacks-test.js @@ -7,12 +7,11 @@ * @flow */ -import {normalizeCodeLocInfo} from './utils'; +import {getVersionedRenderImplementation, normalizeCodeLocInfo} from './utils'; describe('component stack', () => { let React; let act; - let legacyRender; let mockError; let mockWarn; @@ -30,11 +29,12 @@ describe('component stack', () => { const utils = require('./utils'); act = utils.act; - legacyRender = utils.legacyRender; React = require('react'); }); + const {render} = getVersionedRenderImplementation(); + // @reactVersion >=16.9 it('should log the current component stack along with an error or warning', () => { const Grandparent = () => ; @@ -45,9 +45,7 @@ describe('component stack', () => { return null; }; - const container = document.createElement('div'); - - act(() => legacyRender(, container)); + act(() => render()); expect(mockError).toHaveBeenCalledWith( 'Test error.', @@ -79,8 +77,7 @@ describe('component stack', () => { return null; }; - const container = document.createElement('div'); - act(() => legacyRender(, container)); + act(() => render()); expect(useEffectCount).toBe(1);