-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test run that uses www feature flags #18234
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow strict | ||
*/ | ||
|
||
// In www, these flags are controlled by GKs. Because most GKs have some | ||
// population running in either mode, we should run our tests that way, too, | ||
// | ||
// Use __VARIANT__ to simulate a GK. The tests will be run twice: once | ||
// with the __VARIANT__ set to `true`, and once set to `false`. | ||
|
||
export const deferPassiveEffectCleanupDuringUnmount = __VARIANT__; | ||
export const runAllPassiveEffectDestroysBeforeCreates = __VARIANT__; | ||
export const warnAboutSpreadingKeyToJSX = __VARIANT__; | ||
|
||
// These are already tested in both modes using the build type dimension, | ||
// so we don't need to use __VARIANT__ to get extra coverage. | ||
export const debugRenderPhaseSideEffectsForStrictMode = __DEV__; | ||
export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__; | ||
|
||
// TODO: These flags are hard-coded to the default values used in open source. | ||
// Update the tests so that they pass in either mode, then set these | ||
// to __VARIANT__. | ||
export const enableTrustedTypesIntegration = false; | ||
export const warnAboutShorthandPropertyCollision = true; | ||
export const disableInputAttributeSyncing = false; | ||
export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; | ||
export const enableModernEventSystem = false; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
const baseConfig = require('./config.base'); | ||
|
||
const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL; | ||
|
||
// Default to building in experimental mode. If the release channel is set via | ||
// an environment variable, then check if it's "experimental". | ||
const __EXPERIMENTAL__ = | ||
typeof RELEASE_CHANNEL === 'string' | ||
? RELEASE_CHANNEL === 'experimental' | ||
: true; | ||
|
||
const preferredExtension = __EXPERIMENTAL__ ? '.js' : '.stable.js'; | ||
|
||
const moduleNameMapper = {}; | ||
moduleNameMapper[ | ||
'^react$' | ||
] = `<rootDir>/packages/react/index${preferredExtension}`; | ||
moduleNameMapper[ | ||
'^react-dom$' | ||
] = `<rootDir>/packages/react-dom/index${preferredExtension}`; | ||
|
||
module.exports = Object.assign({}, baseConfig, { | ||
// Prefer the stable forks for tests. | ||
moduleNameMapper, | ||
modulePathIgnorePatterns: [ | ||
...baseConfig.modulePathIgnorePatterns, | ||
'packages/react-devtools-shared', | ||
], | ||
setupFiles: [ | ||
...baseConfig.setupFiles, | ||
require.resolve('./setupHostConfigs.js'), | ||
require.resolve('./setupTests.www.js'), | ||
], | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
jest.mock('shared/ReactFeatureFlags', () => { | ||
jest.mock( | ||
'ReactFeatureFlags', | ||
() => jest.requireActual('shared/forks/ReactFeatureFlags.www-dynamic'), | ||
{virtual: true} | ||
); | ||
|
||
const wwwFlags = jest.requireActual('shared/forks/ReactFeatureFlags.www'); | ||
const defaultFlags = jest.requireActual('shared/ReactFeatureFlags'); | ||
|
||
// TODO: Many tests were written before we started running them against the | ||
// www configuration. Update those tests so that they work against the www | ||
// configuration, too. Then remove these overrides. | ||
wwwFlags.disableLegacyContext = defaultFlags.disableLegacyContext; | ||
wwwFlags.warnAboutUnmockedScheduler = defaultFlags.warnAboutUnmockedScheduler; | ||
wwwFlags.enableUserTimingAPI = defaultFlags.enableUserTimingAPI; | ||
wwwFlags.disableJavaScriptURLs = defaultFlags.disableJavaScriptURLs; | ||
wwwFlags.enableDeprecatedFlareAPI = defaultFlags.enableDeprecatedFlareAPI; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @trueadm When I ran the tests with Flare enabled, this test started failing sporadically:
Not sure if this is an issue or not, but letting you know just in case. Since Flare is enabled in the www build. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is known, and it seemed like maybe a fragile test from memory as it’s related to the discrete flushing logic based on the timeStamp logic. |
||
|
||
return wwwFlags; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed this was off in the www build. I think maybe we wanted to ramp this up in case it breaks something? Seems unlikely, but to decouple it from the rest of the changes I've made it a dynamic flag.