Skip to content

Commit 57cd682

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 the older versions of React, because it's a regression test for the legacy Suspense renderer. So it doesn't really need to run for new versions, because the legacy renderer is deprecated and will soon be removed. Test plan: ``` yarn test --build --project devtools --release-channel=experimental --reactVersion 18.0 --watch ```
1 parent 18282f8 commit 57cd682

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

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

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

941-
// @reactVersion >= 18.0
941+
// @reactVersion < 18.2
942942
it('should handle unexpectedly shallow suspense trees', () => {
943943
const container = document.createElement('div');
944944

@@ -963,7 +963,7 @@ describe('ProfilingCache', () => {
963963
2 => 0,
964964
},
965965
"passiveEffectDuration": null,
966-
"priorityLevel": "Normal",
966+
"priorityLevel": "Immediate",
967967
"timestamp": 0,
968968
"updaters": [
969969
{

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)