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

[TestUtils] Build limited test-utils #28782

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Conversation

gnoff
Copy link
Collaborator

@gnoff gnoff commented Apr 8, 2024

We landed a flag to disable test utils in many builds but we need to fork the entrypoint to make it work with tests properly. This also removes test-utils implementations from builds that do not support it. Currently in OSS builds the only thing in test-utils is a reexport of act

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 8, 2024
@react-sizebot
Copy link

react-sizebot commented Apr 8, 2024

Comparing: 4c12339...d476a36

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 169.11 kB 169.11 kB = 52.76 kB 52.76 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 170.91 kB 170.91 kB = 53.27 kB 53.27 kB
facebook-www/ReactDOM-prod.classic.js = 590.58 kB 590.58 kB = 103.86 kB 103.86 kB
facebook-www/ReactDOM-prod.modern.js = 566.68 kB 566.68 kB = 100.01 kB 100.01 kB
oss-experimental/react-dom/umd/react-dom-test-utils.production.min.js = 8.98 kB 0.83 kB = 2.82 kB 0.50 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.production.min.js = 8.98 kB 0.83 kB = 2.82 kB 0.50 kB
oss-stable/react-dom/umd/react-dom-test-utils.production.min.js = 8.98 kB 0.83 kB = 2.82 kB 0.50 kB
oss-experimental/react-dom/umd/react-dom-test-utils.development.js = 29.71 kB 2.41 kB = 7.97 kB 1.17 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.development.js = 29.71 kB 2.41 kB = 7.97 kB 1.17 kB
oss-stable/react-dom/umd/react-dom-test-utils.development.js = 29.71 kB 2.41 kB = 7.97 kB 1.17 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.development.js = 27.96 kB 2.06 kB = 7.82 kB 1.06 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.development.js = 27.96 kB 2.06 kB = 7.82 kB 1.06 kB
oss-stable/react-dom/cjs/react-dom-test-utils.development.js = 27.96 kB 2.06 kB = 7.82 kB 1.06 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.min.js = 8.84 kB 0.60 kB = 2.76 kB 0.39 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.production.min.js = 8.84 kB 0.60 kB = 2.76 kB 0.39 kB
oss-stable/react-dom/cjs/react-dom-test-utils.production.min.js = 8.84 kB 0.60 kB = 2.76 kB 0.39 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.js = 26.65 kB 0.71 kB = 7.23 kB 0.42 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.production.js = 26.65 kB 0.71 kB = 7.23 kB 0.42 kB
oss-stable/react-dom/cjs/react-dom-test-utils.production.js = 26.65 kB 0.71 kB = 7.23 kB 0.42 kB
test_utils/ReactAllWarnings.js Deleted 64.04 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-dom/umd/react-dom-test-utils.production.min.js = 8.98 kB 0.83 kB = 2.82 kB 0.50 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.production.min.js = 8.98 kB 0.83 kB = 2.82 kB 0.50 kB
oss-stable/react-dom/umd/react-dom-test-utils.production.min.js = 8.98 kB 0.83 kB = 2.82 kB 0.50 kB
oss-experimental/react-dom/umd/react-dom-test-utils.development.js = 29.71 kB 2.41 kB = 7.97 kB 1.17 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.development.js = 29.71 kB 2.41 kB = 7.97 kB 1.17 kB
oss-stable/react-dom/umd/react-dom-test-utils.development.js = 29.71 kB 2.41 kB = 7.97 kB 1.17 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.development.js = 27.96 kB 2.06 kB = 7.82 kB 1.06 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.development.js = 27.96 kB 2.06 kB = 7.82 kB 1.06 kB
oss-stable/react-dom/cjs/react-dom-test-utils.development.js = 27.96 kB 2.06 kB = 7.82 kB 1.06 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.min.js = 8.84 kB 0.60 kB = 2.76 kB 0.39 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.production.min.js = 8.84 kB 0.60 kB = 2.76 kB 0.39 kB
oss-stable/react-dom/cjs/react-dom-test-utils.production.min.js = 8.84 kB 0.60 kB = 2.76 kB 0.39 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.js = 26.65 kB 0.71 kB = 7.23 kB 0.42 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.production.js = 26.65 kB 0.71 kB = 7.23 kB 0.42 kB
oss-stable/react-dom/cjs/react-dom-test-utils.production.js = 26.65 kB 0.71 kB = 7.23 kB 0.42 kB
test_utils/ReactAllWarnings.js Deleted 64.04 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Generated by 🚫 dangerJS against d476a36

@@ -27,6 +27,7 @@ function getTestDocument(markup) {
}

describe('ReactTestUtils', () => {
// @gate !disableDOMTestUtils
it('Simulate should have locally attached media events', () => {
expect(Object.keys(ReactTestUtils.Simulate).sort()).toMatchSnapshot();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to switch to inline snapshots. Otherwise Jest thinks that the snapshot is obsolete and fails.

Suggested change
expect(Object.keys(ReactTestUtils.Simulate).sort()).toMatchSnapshot();
expect(Object.keys(ReactTestUtils.Simulate).sort()).toMatchSnapshotInlineSnapshot();

…fork the entrypoint to make it work with tests properly
@gnoff gnoff merged commit 01bb3c5 into facebook:main Apr 8, 2024
37 of 38 checks passed
@gnoff gnoff deleted the fork-test-utils branch April 8, 2024 19:27
rickhanlonii pushed a commit that referenced this pull request Apr 11, 2024
We landed a flag to disable test utils in many builds but we need to
fork the entrypoint to make it work with tests properly. This also
removes test-utils implementations from builds that do not support it.
Currently in OSS builds the only thing in test-utils is a reexport of
`act`
rickhanlonii pushed a commit that referenced this pull request Apr 11, 2024
We landed a flag to disable test utils in many builds but we need to
fork the entrypoint to make it work with tests properly. This also
removes test-utils implementations from builds that do not support it.
Currently in OSS builds the only thing in test-utils is a reexport of
`act`
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
We landed a flag to disable test utils in many builds but we need to
fork the entrypoint to make it work with tests properly. This also
removes test-utils implementations from builds that do not support it.
Currently in OSS builds the only thing in test-utils is a reexport of
`act`
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