Skip to content
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

Run ReactElementJSX-test against bundles #18301

Merged
merged 2 commits into from
Mar 13, 2020
Merged

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Mar 13, 2020

This is an important test. We should run it on bundles, not just source. See #18299 (comment) for the kind of issue it could catch.

I'm removing the internal suffix and moving the only test that actually depends on feature flags by now into its own file. That one stays internal.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 13, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ea3cccd:

Sandbox Source
busy-mahavira-ifszk Configuration

global.Symbol = undefined;

ReactFeatureFlags = require('shared/ReactFeatureFlags');
ReactFeatureFlags.warnAboutSpreadingKeyToJSX = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already true in the test-www-variant run, so instead of moving this to a new file, you can wrap the test in a condition:

if (require('shared/ReactFeatureFlags').warnAboutSpreadingKeyToJSX) {
  // test goes here
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See here:

// 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__;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh smart

@sizebot
Copy link

sizebot commented Mar 13, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against ea3cccd

@sizebot
Copy link

sizebot commented Mar 13, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against ea3cccd

Copy link
Collaborator

@acdlite acdlite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍Assuming tests pass

@gaearon
Copy link
Collaborator Author

gaearon commented Mar 13, 2020

It would be nice to have some way to ensure that a test isn’t completely ignored by all runs because we forgot about giving it a variant.

@acdlite
Copy link
Collaborator

acdlite commented Mar 13, 2020

Yeah that would be nice. Though this is probably only an issue for existing tests, since it'd be weird to write a test that you never run yourself.

Also, if we remove all the hardcoded overrides here:

// 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;

...and here:

// 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;
wwwFlags.disableModulePatternComponents =
defaultFlags.disableModulePatternComponents;

then if a flag is shipped to any of our open source or www channels, it will definitely be tested. So I'm not too worried about this.

@acdlite
Copy link
Collaborator

acdlite commented Mar 13, 2020

Put another way, it's not that big a deal if we neglect to test a configuration that doesn't actually exist in one of our release channels. It's not ideal, because there could be hidden bugs that don't get discovered until we turn the flag on somewhere. But it's more important to test against every possible configuration that actually gets shipped.

@gaearon gaearon merged commit 73ff8b9 into facebook:master Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants