GeezerVison is showing github.com — Add test run that uses www feature flags (#18234) · react/react@115cd12
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .circleci/config.yml +124Lines changed: 124 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -115,6 +115,106 @@ jobs: | 115 | 115 | RELEASE_CHANNEL: experimental | 116 | 116 | command: yarn test --maxWorkers=2 | 117 | 117 |
| | 118 | + test_source_www: | | 119 | + docker: *docker | | 120 | + environment: *environment | | 121 | + steps: | | 122 | + - checkout | | 123 | + - *restore_yarn_cache | | 124 | + - *run_yarn | | 125 | + - run: | | 126 | + environment: | | 127 | + RELEASE_CHANNEL: stable | | 128 | + command: yarn test-www --maxWorkers=2 | | 129 | + | | 130 | + test_source_www_variant: | | 131 | + docker: *docker | | 132 | + environment: *environment | | 133 | + steps: | | 134 | + - checkout | | 135 | + - *restore_yarn_cache | | 136 | + - *run_yarn | | 137 | + - run: | | 138 | + environment: | | 139 | + RELEASE_CHANNEL: stable | | 140 | + command: yarn test-www-variant --maxWorkers=2 | | 141 | + | | 142 | + test_source_www_prod: | | 143 | + docker: *docker | | 144 | + environment: *environment | | 145 | + steps: | | 146 | + - checkout | | 147 | + - *restore_yarn_cache | | 148 | + - *run_yarn | | 149 | + - run: | | 150 | + environment: | | 151 | + NODE_ENV: production | | 152 | + RELEASE_CHANNEL: stable | | 153 | + command: yarn test-www --maxWorkers=2 | | 154 | + | | 155 | + test_source_www_variant_prod: | | 156 | + docker: *docker | | 157 | + environment: *environment | | 158 | + steps: | | 159 | + - checkout | | 160 | + - *restore_yarn_cache | | 161 | + - *run_yarn | | 162 | + - run: | | 163 | + environment: | | 164 | + NODE_ENV: production | | 165 | + RELEASE_CHANNEL: stable | | 166 | + command: yarn test-www-variant --maxWorkers=2 | | 167 | + | | 168 | + test_source_www_experimental: | | 169 | + docker: *docker | | 170 | + environment: *environment | | 171 | + steps: | | 172 | + - checkout | | 173 | + - *restore_yarn_cache | | 174 | + - *run_yarn | | 175 | + - run: | | 176 | + environment: | | 177 | + RELEASE_CHANNEL: experimental | | 178 | + command: yarn test-www --maxWorkers=2 | | 179 | + | | 180 | + test_source_www_variant_experimental: | | 181 | + docker: *docker | | 182 | + environment: *environment | | 183 | + steps: | | 184 | + - checkout | | 185 | + - *restore_yarn_cache | | 186 | + - *run_yarn | | 187 | + - run: | | 188 | + environment: | | 189 | + RELEASE_CHANNEL: experimental | | 190 | + command: yarn test-www-variant --maxWorkers=2 | | 191 | + | | 192 | + test_source_www_prod_experimental: | | 193 | + docker: *docker | | 194 | + environment: *environment | | 195 | + steps: | | 196 | + - checkout | | 197 | + - *restore_yarn_cache | | 198 | + - *run_yarn | | 199 | + - run: | | 200 | + environment: | | 201 | + NODE_ENV: production | | 202 | + RELEASE_CHANNEL: experimental | | 203 | + command: yarn test-www --maxWorkers=2 | | 204 | + | | 205 | + test_source_www_variant_prod_experimental: | | 206 | + docker: *docker | | 207 | + environment: *environment | | 208 | + steps: | | 209 | + - checkout | | 210 | + - *restore_yarn_cache | | 211 | + - *run_yarn | | 212 | + - run: | | 213 | + environment: | | 214 | + NODE_ENV: production | | 215 | + RELEASE_CHANNEL: experimental | | 216 | + command: yarn test-www-variant --maxWorkers=2 | | 217 | + | 118 | 218 | test_source_persistent: | 119 | 219 | docker: *docker | 120 | 220 | environment: *environment | @@ -384,6 +484,18 @@ workflows: | 384 | 484 | - test_source_persistent: | 385 | 485 | requires: | 386 | 486 | - setup | | 487 | + - test_source_www: | | 488 | + requires: | | 489 | + - setup | | 490 | + - test_source_www_variant: | | 491 | + requires: | | 492 | + - setup | | 493 | + - test_source_www_prod: | | 494 | + requires: | | 495 | + - setup | | 496 | + - test_source_www_variant_prod: | | 497 | + requires: | | 498 | + - setup | 387 | 499 | - build: | 388 | 500 | requires: | 389 | 501 | - setup | @@ -415,6 +527,18 @@ workflows: | 415 | 527 | - test_source_prod_experimental: | 416 | 528 | requires: | 417 | 529 | - setup | | 530 | + - test_source_www_experimental: | | 531 | + requires: | | 532 | + - setup | | 533 | + - test_source_www_variant_experimental: | | 534 | + requires: | | 535 | + - setup | | 536 | + - test_source_www_prod_experimental: | | 537 | + requires: | | 538 | + - setup | | 539 | + - test_source_www_variant_prod_experimental: | | 540 | + requires: | | 541 | + - setup | 418 | 542 | - build_experimental: | 419 | 543 | requires: | 420 | 544 | - setup | |
Collapse file Copy file name to clipboardExpand all lines: .eslintrc.js +3-5Lines changed: 3 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,10 +11,7 @@ const OFF = 0; | 11 | 11 | const ERROR = 2; | 12 | 12 |
| 13 | 13 | module.exports = { | 14 | | - extends: [ | 15 | | - 'fbjs', | 16 | | - 'prettier' | 17 | | - ], | | 14 | + extends: ['fbjs', 'prettier'], | 18 | 15 |
| 19 | 16 | // Stop ESLint from looking for a configuration file in parent folders | 20 | 17 | root: true, | @@ -147,7 +144,7 @@ module.exports = { | 147 | 144 | 'scripts/**/*.js', | 148 | 145 | 'packages/*/npm/**/*.js', | 149 | 146 | 'packages/dom-event-testing-library/**/*.js', | 150 | | - 'packages/react-devtools*/**/*.js' | | 147 | + 'packages/react-devtools*/**/*.js', | 151 | 148 | ], | 152 | 149 | rules: { | 153 | 150 | 'react-internal/no-production-logging': OFF, | @@ -171,6 +168,7 @@ module.exports = { | 171 | 168 | __PROFILE__: true, | 172 | 169 | __UMD__: true, | 173 | 170 | __EXPERIMENTAL__: true, | | 171 | + __VARIANT__: true, | 174 | 172 | trustedTypes: true, | 175 | 173 | }, | 176 | 174 | }; |
Collapse file Copy file name to clipboardExpand all lines: package.json +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 108 | 108 | "postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json && node ./scripts/flow/createFlowConfigs.js && node ./scripts/yarn/downloadReactIsForPrettyFormat.js", | 109 | 109 | "debug-test": "cross-env NODE_ENV=development node --inspect-brk node_modules/jest/bin/jest.js --config ./scripts/jest/config.source.js --runInBand", | 110 | 110 | "test": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source.js", | | 111 | + "test-www": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-www.js", | | 112 | + "test-www-variant": "cross-env NODE_ENV=development VARIANT=true jest --config ./scripts/jest/config.source-www.js", | 111 | 113 | "test-persistent": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-persistent.js", | 112 | 114 | "debug-test-persistent": "cross-env NODE_ENV=development node --inspect-brk node_modules/jest/bin/jest.js --config ./scripts/jest/config.source-persistent.js --runInBand", | 113 | 115 | "test-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source.js", | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactServerRendering-test.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,6 +14,8 @@ let React; | 14 | 14 | let ReactDOMServer; | 15 | 15 | let PropTypes; | 16 | 16 | let ReactCurrentDispatcher; | | 17 | +let enableSuspenseServerRenderer = require('shared/ReactFeatureFlags') | | 18 | + .enableSuspenseServerRenderer; | 17 | 19 |
| 18 | 20 | function normalizeCodeLocInfo(str) { | 19 | 21 | return str && str.replace(/\(at .+?:\d+\)/g, '(at **)'); | @@ -686,7 +688,7 @@ describe('ReactDOMServer', () => { | 686 | 688 | expect(markup).toBe('<div></div>'); | 687 | 689 | }); | 688 | 690 |
| 689 | | - if (!__EXPERIMENTAL__) { | | 691 | + if (!enableSuspenseServerRenderer) { | 690 | 692 | it('throws for unsupported types on the server', () => { | 691 | 693 | expect(() => { | 692 | 694 | ReactDOMServer.renderToString(<React.Suspense />); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiber.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -973,10 +973,10 @@ export function assignFiberPropertiesInDEV( | 973 | 973 | } | 974 | 974 | if (enableUserTimingAPI) { | 975 | 975 | target._debugID = source._debugID; | | 976 | + target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; | 976 | 977 | } | 977 | 978 | target._debugSource = source._debugSource; | 978 | 979 | target._debugOwner = source._debugOwner; | 979 | | - target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; | 980 | 980 | target._debugNeedsRemount = source._debugNeedsRemount; | 981 | 981 | target._debugHookTypes = source._debugHookTypes; | 982 | 982 | return target; | |
Collapse file Copy file name to clipboard +32Lines changed: 32 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +/** | | 2 | + * Copyright (c) Facebook, Inc. and its affiliates. | | 3 | + * | | 4 | + * This source code is licensed under the MIT license found in the | | 5 | + * LICENSE file in the root directory of this source tree. | | 6 | + * | | 7 | + * @flow strict | | 8 | + */ | | 9 | + | | 10 | +// In www, these flags are controlled by GKs. Because most GKs have some | | 11 | +// population running in either mode, we should run our tests that way, too, | | 12 | +// | | 13 | +// Use __VARIANT__ to simulate a GK. The tests will be run twice: once | | 14 | +// with the __VARIANT__ set to `true`, and once set to `false`. | | 15 | + | | 16 | +export const deferPassiveEffectCleanupDuringUnmount = __VARIANT__; | | 17 | +export const runAllPassiveEffectDestroysBeforeCreates = __VARIANT__; | | 18 | +export const warnAboutSpreadingKeyToJSX = __VARIANT__; | | 19 | + | | 20 | +// These are already tested in both modes using the build type dimension, | | 21 | +// so we don't need to use __VARIANT__ to get extra coverage. | | 22 | +export const debugRenderPhaseSideEffectsForStrictMode = __DEV__; | | 23 | +export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__; | | 24 | + | | 25 | +// TODO: These flags are hard-coded to the default values used in open source. | | 26 | +// Update the tests so that they pass in either mode, then set these | | 27 | +// to __VARIANT__. | | 28 | +export const enableTrustedTypesIntegration = false; | | 29 | +export const warnAboutShorthandPropertyCollision = true; | | 30 | +export const disableInputAttributeSyncing = false; | | 31 | +export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; | | 32 | +export const enableModernEventSystem = false; |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/forks/ReactFeatureFlags.www.js +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 |
| 10 | 10 | import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; | 11 | 11 | import typeof * as ExportsType from './ReactFeatureFlags.www'; | | 12 | +import typeof * as DynamicFeatureFlags from './ReactFeatureFlags.www-dynamic'; | 12 | 13 |
| 13 | 14 | // Re-export dynamic flags from the www version. | | 15 | +const dynamicFeatureFlags: DynamicFeatureFlags = require('ReactFeatureFlags'); | | 16 | + | 14 | 17 | export const { | 15 | 18 | debugRenderPhaseSideEffectsForStrictMode, | 16 | 19 | deferPassiveEffectCleanupDuringUnmount, | @@ -20,8 +23,9 @@ export const { | 20 | 23 | warnAboutShorthandPropertyCollision, | 21 | 24 | disableSchedulerTimeoutBasedOnReactExpirationTime, | 22 | 25 | warnAboutSpreadingKeyToJSX, | | 26 | + replayFailedUnitOfWorkWithInvokeGuardedCallback, | 23 | 27 | enableModernEventSystem, | 24 | | -} = require('ReactFeatureFlags'); | | 28 | +} = dynamicFeatureFlags; | 25 | 29 |
| 26 | 30 | // On WWW, __EXPERIMENTAL__ is used for a new modern build. | 27 | 31 | // It's not used anywhere in production yet. | @@ -39,7 +43,6 @@ export const enableProfilerCommitHooks = false; | 39 | 43 | export const enableSchedulerTracing = __PROFILE__; | 40 | 44 | export const enableSchedulerDebugging = true; | 41 | 45 |
| 42 | | -export const replayFailedUnitOfWorkWithInvokeGuardedCallback = false; | 43 | 46 | export const warnAboutDeprecatedLifecycles = true; | 44 | 47 | export const disableLegacyContext = __EXPERIMENTAL__; | 45 | 48 | export const warnAboutStringRefs = false; | |
Collapse file Copy file name to clipboardExpand all lines: scripts/flow/environment.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 12 | 12 | declare var __PROFILE__: boolean; | 13 | 13 | declare var __UMD__: boolean; | 14 | 14 | declare var __EXPERIMENTAL__: boolean; | | 15 | +declare var __VARIANT__: boolean; | 15 | 16 |
| 16 | 17 | declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{ | 17 | 18 | inject: ?((stuff: Object) => void) | |
Collapse file Copy file name to clipboard +36Lines changed: 36 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +'use strict'; | | 2 | + | | 3 | +const baseConfig = require('./config.base'); | | 4 | + | | 5 | +const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL; | | 6 | + | | 7 | +// Default to building in experimental mode. If the release channel is set via | | 8 | +// an environment variable, then check if it's "experimental". | | 9 | +const __EXPERIMENTAL__ = | | 10 | + typeof RELEASE_CHANNEL === 'string' | | 11 | + ? RELEASE_CHANNEL === 'experimental' | | 12 | + : true; | | 13 | + | | 14 | +const preferredExtension = __EXPERIMENTAL__ ? '.js' : '.stable.js'; | | 15 | + | | 16 | +const moduleNameMapper = {}; | | 17 | +moduleNameMapper[ | | 18 | + '^react$' | | 19 | +] = `<rootDir>/packages/react/index${preferredExtension}`; | | 20 | +moduleNameMapper[ | | 21 | + '^react-dom$' | | 22 | +] = `<rootDir>/packages/react-dom/index${preferredExtension}`; | | 23 | + | | 24 | +module.exports = Object.assign({}, baseConfig, { | | 25 | + // Prefer the stable forks for tests. | | 26 | + moduleNameMapper, | | 27 | + modulePathIgnorePatterns: [ | | 28 | + ...baseConfig.modulePathIgnorePatterns, | | 29 | + 'packages/react-devtools-shared', | | 30 | + ], | | 31 | + setupFiles: [ | | 32 | + ...baseConfig.setupFiles, | | 33 | + require.resolve('./setupHostConfigs.js'), | | 34 | + require.resolve('./setupTests.www.js'), | | 35 | + ], | | 36 | +}); |
Collapse file Copy file name to clipboardExpand all lines: scripts/jest/setupEnvironment.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,6 +17,8 @@ global.__EXPERIMENTAL__ = | 17 | 17 | ? RELEASE_CHANNEL === 'experimental' | 18 | 18 | : true; | 19 | 19 |
| | 20 | +global.__VARIANT__ = !!process.env.VARIANT; | | 21 | + | 20 | 22 | if (typeof window !== 'undefined') { | 21 | 23 | global.requestIdleCallback = function(callback) { | 22 | 24 | return setTimeout(() => { | |
|