Skip to content

Commit

Permalink
Gate DevTools test to fix CI (facebook#26742)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
acdlite authored and AndyPengc12 committed Apr 15, 2024
1 parent 4383dda commit 5c7e2b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,10 @@ describe('ProfilingCache', () => {
}
});

// @reactVersion >= 18.0
// @reactVersion = 17.0
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 All @@ -965,15 +967,7 @@ describe('ProfilingCache', () => {
"passiveEffectDuration": null,
"priorityLevel": "Normal",
"timestamp": 0,
"updaters": [
{
"displayName": "render()",
"hocDisplayNames": null,
"id": 1,
"key": null,
"type": 11,
},
],
"updaters": null,
},
]
`);
Expand Down
12 changes: 9 additions & 3 deletions scripts/jest/jest-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const devToolsConfig = './scripts/jest/config.build-devtools.js';
const persistentConfig = './scripts/jest/config.source-persistent.js';
const buildConfig = './scripts/jest/config.build.js';

const {ReactVersion} = require('../../ReactVersions');

const argv = yargs
.parserConfiguration({
// Important: This option tells yargs to move all other options not
Expand Down Expand Up @@ -179,9 +181,13 @@ function validateOptions() {
success = false;
}

if (argv.reactVersion && !semver.validRange(argv.reactVersion)) {
success = false;
logError('please specify a valid version range for --reactVersion');
if (argv.reactVersion) {
if (!semver.validRange(argv.reactVersion)) {
success = false;
logError('please specify a valid version range for --reactVersion');
}
} else {
argv.reactVersion = ReactVersion;
}
} else {
if (argv.compactConsole) {
Expand Down

0 comments on commit 5c7e2b1

Please sign in to comment.