Skip to content

Commit

Permalink
fix[devtools/profilingCache-test]: specify correct version gate for t…
Browse files Browse the repository at this point in the history
…est (#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
  • Loading branch information
hoxyq authored Jun 26, 2023
1 parent 8ec962d commit 6aacd3f
Showing 1 changed file with 44 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -938,11 +938,51 @@ describe('ProfilingCache', () => {
}
});

// @reactVersion >= 17
// @reactVersion < 18
// @reactVersion >= 18.0.0
// @reactVersion <= 18.2.0
it('should handle unexpectedly shallow suspense trees for react v[18.0.0 - 18.2.0]', () => {
const container = document.createElement('div');

utils.act(() => store.profilerStore.startProfiling());
utils.act(() => legacyRender(<React.Suspense />, container));
utils.act(() => store.profilerStore.stopProfiling());

const rootID = store.roots[0];
const commitData = store.profilerStore.getDataForRoot(rootID).commitData;
expect(commitData).toMatchInlineSnapshot(`
[
{
"changeDescriptions": Map {},
"duration": 0,
"effectDuration": null,
"fiberActualDurations": Map {
1 => 0,
2 => 0,
},
"fiberSelfDurations": Map {
1 => 0,
2 => 0,
},
"passiveEffectDuration": null,
"priorityLevel": "Immediate",
"timestamp": 0,
"updaters": [
{
"displayName": "render()",
"hocDisplayNames": null,
"id": 1,
"key": null,
"type": 11,
},
],
},
]
`);
});

// This test is not gated.
// For this test we use the current version of react, built from source.
it('should handle unexpectedly shallow suspense trees', () => {
// This test only runs in v17 because it's a regression test for legacy
// Suspense behavior, and the implementation details changed in v18.
const container = document.createElement('div');

utils.act(() => store.profilerStore.startProfiling());
Expand Down

0 comments on commit 6aacd3f

Please sign in to comment.