From 7bf3c5c00383947a76c911f4237b89a1f6975e08 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Mon, 14 Oct 2024 21:19:12 +0100 Subject: [PATCH] fix[react-devtools]: fixed timeline profiler tests --- .../src/__tests__/TimelineProfiler-test.js | 12 ++++++++---- .../src/__tests__/setupTests.js | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js b/packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js index b4cc9bbc0bafc..e632227ab3a79 100644 --- a/packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js +++ b/packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js @@ -1280,13 +1280,13 @@ describe('Timeline profiler', () => { }); describe('when profiling', () => { - beforeEach(() => { - utils.act(() => store.profilerStore.startProfiling()); - }); - describe('with legacy render', () => { const {render: legacyRender} = getLegacyRenderImplementation(); + beforeEach(() => { + utils.act(() => store.profilerStore.startProfiling()); + }); + // @reactVersion <= 18.2 // @reactVersion >= 18.0 it('should mark sync render without suspends or state updates', () => { @@ -1537,6 +1537,10 @@ describe('Timeline profiler', () => { const {render: modernRender} = getModernRenderImplementation(); + beforeEach(() => { + utils.act(() => store.profilerStore.startProfiling()); + }); + it('should mark concurrent render without suspends or state updates', () => { utils.act(() => modernRender(
)); diff --git a/packages/react-devtools-shared/src/__tests__/setupTests.js b/packages/react-devtools-shared/src/__tests__/setupTests.js index 0a821345fcbac..50431b230ad87 100644 --- a/packages/react-devtools-shared/src/__tests__/setupTests.js +++ b/packages/react-devtools-shared/src/__tests__/setupTests.js @@ -256,7 +256,9 @@ beforeEach(() => { }, }); - const store = new Store(((bridge: any): FrontendBridge)); + const store = new Store(((bridge: any): FrontendBridge), { + supportsTimeline: true, + }); const agent = new Agent(((bridge: any): BackendBridge)); const hook = global.__REACT_DEVTOOLS_GLOBAL_HOOK__;