Skip to content

Commit 79793dd

Browse files
committed
Gate DevTools test to fix CI
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 ```
1 parent 18282f8 commit 79793dd

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

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

941-
// @reactVersion >= 18.0
941+
// @reactVersion = 17.0
942942
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.
943945
const container = document.createElement('div');
944946

945947
utils.act(() => store.profilerStore.startProfiling());
@@ -965,15 +967,7 @@ describe('ProfilingCache', () => {
965967
"passiveEffectDuration": null,
966968
"priorityLevel": "Normal",
967969
"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,
977971
},
978972
]
979973
`);

scripts/jest/jest-cli.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const devToolsConfig = './scripts/jest/config.build-devtools.js';
1616
const persistentConfig = './scripts/jest/config.source-persistent.js';
1717
const buildConfig = './scripts/jest/config.build.js';
1818

19+
const {ReactVersion} = require('../../ReactVersions');
20+
1921
const argv = yargs
2022
.parserConfiguration({
2123
// Important: This option tells yargs to move all other options not
@@ -179,9 +181,13 @@ function validateOptions() {
179181
success = false;
180182
}
181183

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;
185191
}
186192
} else {
187193
if (argv.compactConsole) {

0 commit comments

Comments
 (0)