Fix test_build_devtools CI job to run test-build-devtools (#17631)
* Skip abandoned project folders in Jest config This fixes a problem that occurs after renaming a package. * Fix test_build_devtools to run test-build-devtools * Exclude console.error plugin for DevTools packages * Use correct release channel for DevTools tests This should fix the createRoot error. * Fix TZ dependent test * Change DT job dependencies
Dan Abramov committed
Dec 17, 2019 at 00:03 UTC
36a6e29bb3eead85e3500ba7269cbcd55516a8fb
5 files changed
+30
-14
.circleci/config.yml
+3
-3
@@ -277,8 +277,8 @@ jobs:
277
- *run_yarn
278
- run:
279
environment:
280
- RELEASE_CHANNEL: stable
281
- command: yarn test-build --maxWorkers=2
280
+ RELEASE_CHANNEL: experimental
281
+ command: yarn test-build-devtools --maxWorkers=2
282
283
test_dom_fixtures:
284
docker: *docker
@@ -376,7 +376,7 @@ workflows:
376
- build
377
- test_build_devtools:
378
requires:
379
- - build
379
+ - build_experimental
380
- test_dom_fixtures:
381
requires:
382
- build
packages/react-devtools-shared/src/__tests__/inspectedElementContext-test.js
+6
-5
@@ -514,6 +514,7 @@ describe('InspectedElementContext', () => {
514
const arrayOfArrays = [[['abc', 123, true], []]];
515
const div = document.createElement('div');
516
const exampleFunction = () => {};
517
+ const exampleDateISO = '2019-12-31T23:42:42.000Z';
518
const setShallow = new Set(['abc', 123]);
519
const mapShallow = new Map([['name', 'Brian'], ['food', 'sushi']]);
520
const setOfSets = new Set([new Set(['a', 'b', 'c']), new Set([1, 2, 3])]);
@@ -542,7 +543,7 @@ describe('InspectedElementContext', () => {
543
// eslint-disable-next-line no-undef
544
big_int={BigInt(123)}
545
data_view={dataView}
545
- date={new Date(123)}
546
+ date={new Date(exampleDateISO)}
547
fn={exampleFunction}
548
html_element={div}
549
immutable={immutableMap}
@@ -634,11 +635,11 @@ describe('InspectedElementContext', () => {
635
636
expect(date[meta.inspectable]).toBe(false);
637
expect(date[meta.type]).toBe('date');
637
- expect(date[meta.preview_long]).toBe(
638
- 'Wed Dec 31 1969 16:00:00 GMT-0800 (Pacific Standard Time)',
638
+ expect(new Date(date[meta.preview_long]).toISOString()).toBe(
639
+ exampleDateISO,
640
);
640
- expect(date[meta.preview_short]).toBe(
641
- 'Wed Dec 31 1969 16:00:00 GMT-0800 (Pacific Standard Time)',
641
+ expect(new Date(date[meta.preview_short]).toISOString()).toBe(
642
+ exampleDateISO,
643
);
644
645
expect(fn[meta.inspectable]).toBe(false);
scripts/jest/config.build-devtools.js
+7
-1
@@ -14,7 +14,13 @@ const packages = readdirSync(packagesRoot).filter(dir => {
14
return false;
15
}
16
const packagePath = join(packagesRoot, dir, 'package.json');
17
- return statSync(packagePath).isFile();
17
+ let stat;
18
+ try {
19
+ stat = statSync(packagePath);
20
+ } catch (err) {
21
+ return false;
22
+ }
23
+ return stat.isFile();
24
});
25
26
// Create a module map to point React packages to the build output
scripts/jest/config.build.js
+7
-1
@@ -11,7 +11,13 @@ const packages = readdirSync(packagesRoot).filter(dir => {
11
return false;
12
}
13
const packagePath = join(packagesRoot, dir, 'package.json');
14
- return statSync(packagePath).isFile();
14
+ let stat;
15
+ try {
16
+ stat = statSync(packagePath);
17
+ } catch (err) {
18
+ return false;
19
+ }
20
+ return stat.isFile();
21
});
22
23
// Create a module map to point React packages to the build output
scripts/jest/preprocessor.js
+7
-4
@@ -68,11 +68,14 @@ module.exports = {
68
// for test files, we also apply the async-await transform, but we want to
69
// make sure we don't accidentally apply that transform to product code.
70
const isTestFile = !!filePath.match(/\/__tests__\//);
71
+ const isInDevToolsPackages = !!filePath.match(
72
+ /\/packages\/react-devtools.*\//
73
+ );
74
const testOnlyPlugins = [pathToBabelPluginAsyncToGenerator];
72
- const sourceOnlyPlugins =
73
- process.env.NODE_ENV === 'development'
74
- ? [pathToBabelPluginReplaceConsoleCalls]
75
- : [];
75
+ const sourceOnlyPlugins = [];
76
+ if (process.env.NODE_ENV === 'development' && !isInDevToolsPackages) {
77
+ sourceOnlyPlugins.push(pathToBabelPluginReplaceConsoleCalls);
78
+ }
79
const plugins = (isTestFile ? testOnlyPlugins : sourceOnlyPlugins).concat(
80
babelOptions.plugins
81
);