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 https://github.com/facebook/react/pull/26742 - I have recently fixed the gating logic in https://github.com/facebook/react/pull/26955 and https://github.com/facebook/react/pull/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 https://github.com/facebook/react/pull/26512
Ruslan Lesiutin committed
Jun 26, 2023 at 17:37 UTC
6aacd3fa1567ed35c7ae4a69627ec1a1543df760
1 file changed
+44
-4
packages/react-devtools-shared/src/__tests__/profilingCache-test.js
+44
-4
@@ -938,11 +938,51 @@ describe('ProfilingCache', () => {
938
}
939
});
940
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.
985
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.
986
const container = document.createElement('div');
987
988
utils.act(() => store.profilerStore.startProfiling());