Skip to content

Commit 6aacd3f

Browse files
authored
fix[devtools/profilingCache-test]: specify correct version gate for test (#27008)
- Correctly gate the test to `[18.0.0, 18.2.0]` versions of react, as it was initially defined before #26742 - I have recently fixed the gating logic in #26955 and #26997, should be stable now - I have added a non-gated version of this test, which should run only for the current version of react, the one we build from sources - The test version for react `v[18.0.0, 18.2.0]` should expect `"priorityLevel": "Immediate"`, the other `"priorityLevel": "Normal"`, as it was changed in #26512
1 parent 8ec962d commit 6aacd3f

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

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

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -938,11 +938,51 @@ describe('ProfilingCache', () => {
938938
}
939939
});
940940

941-
// @reactVersion >= 17
942-
// @reactVersion < 18
941+
// @reactVersion >= 18.0.0
942+
// @reactVersion <= 18.2.0
943+
it('should handle unexpectedly shallow suspense trees for react v[18.0.0 - 18.2.0]', () => {
944+
const container = document.createElement('div');
945+
946+
utils.act(() => store.profilerStore.startProfiling());
947+
utils.act(() => legacyRender(<React.Suspense />, container));
948+
utils.act(() => store.profilerStore.stopProfiling());
949+
950+
const rootID = store.roots[0];
951+
const commitData = store.profilerStore.getDataForRoot(rootID).commitData;
952+
expect(commitData).toMatchInlineSnapshot(`
953+
[
954+
{
955+
"changeDescriptions": Map {},
956+
"duration": 0,
957+
"effectDuration": null,
958+
"fiberActualDurations": Map {
959+
1 => 0,
960+
2 => 0,
961+
},
962+
"fiberSelfDurations": Map {
963+
1 => 0,
964+
2 => 0,
965+
},
966+
"passiveEffectDuration": null,
967+
"priorityLevel": "Immediate",
968+
"timestamp": 0,
969+
"updaters": [
970+
{
971+
"displayName": "render()",
972+
"hocDisplayNames": null,
973+
"id": 1,
974+
"key": null,
975+
"type": 11,
976+
},
977+
],
978+
},
979+
]
980+
`);
981+
});
982+
983+
// This test is not gated.
984+
// For this test we use the current version of react, built from source.
943985
it('should handle unexpectedly shallow suspense trees', () => {
944-
// This test only runs in v17 because it's a regression test for legacy
945-
// Suspense behavior, and the implementation details changed in v18.
946986
const container = document.createElement('div');
947987

948988
utils.act(() => store.profilerStore.startProfiling());

0 commit comments

Comments
 (0)