@samitouri / QOS-React / commits / 86b0e91998

Gate DevTools test to fix CI (#26742)

This test started failing recently in older versions of React because the Scheduler priority inside a microtask is Normal instead of Immediate. This is expected because microtasks are not Scheduler tasks; it's an implementation detail. I gated the test to only run in v17 because it's a regression test for legacy Suspense behavior, and the implementation details of the snapshot changed in v18. Test plan --------- Using latest: ``` yarn test --build --project devtools --release-channel=experimental profilingcache ``` Using v17 (typically runs in a timed CI workflow): ``` /scripts/circleci/download_devtools_regression_build.js 17.0 --replaceBuild yarn test --build --project devtools --release-channel=experimental --reactVersion 17.0 profilingcache ```

Andrew Clark committed Apr 29, 2023 at 11:14 UTC 86b0e91998a04b22bb54a95d54f4a7632efa902f
2 files changed +13 -13
packages/react-devtools-shared/src/__tests__/profilingCache-test.js
+4 -10
@@ -938,8 +938,10 @@ describe('ProfilingCache', () => {
938 }
939 });
940
941 - // @reactVersion >= 18.0
941 + // @reactVersion = 17.0
942 it('should handle unexpectedly shallow suspense trees', () => {
943 + // This test only runs in v17 because it's a regression test for legacy
944 + // Suspense behavior, and the implementation details changed in v18.
945 const container = document.createElement('div');
946
947 utils.act(() => store.profilerStore.startProfiling());
@@ -965,15 +967,7 @@ describe('ProfilingCache', () => {
967 "passiveEffectDuration": null,
968 "priorityLevel": "Normal",
969 "timestamp": 0,
968 - "updaters": [
969 - {
970 - "displayName": "render()",
971 - "hocDisplayNames": null,
972 - "id": 1,
973 - "key": null,
974 - "type": 11,
975 - },
976 - ],
970 + "updaters": null,
971 },
972 ]
973 `);
scripts/jest/jest-cli.js
+9 -3
@@ -16,6 +16,8 @@ const devToolsConfig = './scripts/jest/config.build-devtools.js';
16 const persistentConfig = './scripts/jest/config.source-persistent.js';
17 const buildConfig = './scripts/jest/config.build.js';
18
19 +const {ReactVersion} = require('../../ReactVersions');
20 +
21 const argv = yargs
22 .parserConfiguration({
23 // Important: This option tells yargs to move all other options not
@@ -179,9 +181,13 @@ function validateOptions() {
181 success = false;
182 }
183
182 - if (argv.reactVersion && !semver.validRange(argv.reactVersion)) {
183 - success = false;
184 - logError('please specify a valid version range for --reactVersion');
184 + if (argv.reactVersion) {
185 + if (!semver.validRange(argv.reactVersion)) {
186 + success = false;
187 + logError('please specify a valid version range for --reactVersion');
188 + }
189 + } else {
190 + argv.reactVersion = ReactVersion;
191 }
192 } else {
193 if (argv.compactConsole) {