Skip to content

Commit c0abd0d

Browse files
committed
fix[ci]: fixed jest configuration not to skip too many devtools tests
1 parent 4ddc019 commit c0abd0d

File tree

6 files changed

+19
-30
lines changed

6 files changed

+19
-30
lines changed

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

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

941-
// @reactVersion = 17.0
941+
// @reactVersion >= 17
942+
// @reactVersion < 18
942943
it('should handle unexpectedly shallow suspense trees', () => {
943944
// This test only runs in v17 because it's a regression test for legacy
944945
// Suspense behavior, and the implementation details changed in v18.
@@ -967,7 +968,15 @@ describe('ProfilingCache', () => {
967968
"passiveEffectDuration": null,
968969
"priorityLevel": "Normal",
969970
"timestamp": 0,
970-
"updaters": null,
971+
"updaters": [
972+
{
973+
"displayName": "render()",
974+
"hocDisplayNames": null,
975+
"id": 1,
976+
"key": null,
977+
"type": 11,
978+
},
979+
],
971980
},
972981
]
973982
`);

packages/react-devtools-shared/src/__tests__/transform-react-version-pragma-test.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,4 @@ describe('transform-react-version-pragma', () => {
137137
expect(shouldPass).toBe(true);
138138
expect(isFocused).toBe(true);
139139
});
140-
141-
test('ignore test if no reactVersion', () => {
142-
expect(shouldPass).toBe(false);
143-
expect(shouldIgnore).toBe(true);
144-
});
145-
146-
test.only('ignore focused test if no reactVersion', () => {
147-
expect(shouldPass).toBe(false);
148-
expect(shouldIgnore).toBe(true);
149-
});
150140
});

packages/shared/ReactVersion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
// TODO: This module is used both by the release scripts and to expose a version
1414
// at runtime. We should instead inject the version number as part of the build
1515
// process, and use the ReactVersions.js module as the single source of truth.
16-
export default '18.2.0';
16+
export default '18.3.0';

scripts/babel/transform-react-version-pragma.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
const getComments = require('./getComments');
66

77
const GATE_VERSION_STR = '@reactVersion ';
8+
const REACT_VERSION_ENV = process.env.REACT_VERSION;
89

910
function transform(babel) {
1011
const {types: t} = babel;
@@ -75,7 +76,7 @@ function transform(babel) {
7576
? '_test_react_version_focus'
7677
: '_test_react_version';
7778
expression.arguments = [condition, ...expression.arguments];
78-
} else {
79+
} else if (REACT_VERSION_ENV) {
7980
callee.name = '_test_ignore_for_react_version';
8081
}
8182
}
@@ -96,7 +97,7 @@ function transform(babel) {
9697
t.identifier('_test_react_version_focus'),
9798
[condition, ...expression.arguments]
9899
);
99-
} else {
100+
} else if (REACT_VERSION_ENV) {
100101
statement.expression = t.callExpression(
101102
t.identifier('_test_ignore_for_react_version'),
102103
expression.arguments

scripts/jest/jest-cli.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ 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-
2119
const argv = yargs
2220
.parserConfiguration({
2321
// Important: This option tells yargs to move all other options not
@@ -181,13 +179,9 @@ function validateOptions() {
181179
success = false;
182180
}
183181

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;
182+
if (argv.reactVersion && !semver.validRange(argv.reactVersion)) {
183+
success = false;
184+
logError('please specify a valid version range for --reactVersion');
191185
}
192186
} else {
193187
if (argv.compactConsole) {

scripts/jest/preprocessor.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,7 @@ module.exports = {
8686
const plugins = (isTestFile ? testOnlyPlugins : sourceOnlyPlugins).concat(
8787
babelOptions.plugins
8888
);
89-
if (
90-
isTestFile &&
91-
isInDevToolsPackages &&
92-
(process.env.REACT_VERSION ||
93-
filePath.match(/\/transform-react-version-pragma-test/))
94-
) {
89+
if (isTestFile && isInDevToolsPackages) {
9590
plugins.push(pathToTransformReactVersionPragma);
9691
}
9792
let sourceAst = hermesParser.parse(src, {babel: true});

0 commit comments

Comments
 (0)