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

Testing builds #18196

Closed
wants to merge 1 commit into from
Closed

Conversation

threepointone
Copy link
Contributor

@threepointone threepointone commented Mar 2, 2020

We removed this in #18138 to unblock 16.13. This PR brings them back, with some changes -

  • testing builds are prefixed with unstable-, i.e - react-dom/unstable-testing
  • added back to bundles.js
  • introduces the __TESTING__ global. Not used to generate the actual builds, but is used for test specific logic
  • removes the .testing forks of ReactFeatureFlags
  • flushes suspense fallbacks in prod for testing builds
  • changes tests in TestUtilsAct to reflect this
  • adds a testing build for react as well
  • and finally removes the testing sigils from prod builds. nice.
  • misc test config changes

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Mar 2, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 2, 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 34baecb:

Sandbox Source
tender-dirac-mkt4x Configuration

@sizebot
Copy link

sizebot commented Mar 2, 2020

Details of bundled changes.

Comparing: 7e83af1...34baecb

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react.development.js 0.0% 0.0% 99.51 KB 99.54 KB 24.48 KB 24.49 KB UMD_DEV
ReactTesting-dev.js n/a n/a 0 B 74.46 KB 0 B 18.91 KB FB_WWW_DEV
ReactTesting-prod.js n/a n/a 0 B 17.71 KB 0 B 4.57 KB FB_WWW_PROD
react-unstable-testing.development.js n/a n/a 0 B 99.56 KB 0 B 24.5 KB UMD_DEV
ReactTesting-profiling.js n/a n/a 0 B 17.71 KB 0 B 4.57 KB FB_WWW_PROFILING
react-unstable-testing.production.min.js n/a n/a 0 B 11.62 KB 0 B 4.57 KB UMD_PROD
react-unstable-testing.profiling.min.js n/a n/a 0 B 15.16 KB 0 B 5.69 KB UMD_PROFILING
react-unstable-testing.development.js n/a n/a 0 B 61.43 KB 0 B 16.77 KB NODE_DEV
react-unstable-testing.production.min.js n/a n/a 0 B 6.55 KB 0 B 2.67 KB NODE_PROD
react.development.js 0.0% 0.0% 61.38 KB 61.41 KB 16.75 KB 16.76 KB NODE_DEV
react.production.min.js -0.5% -0.8% 6.54 KB 6.5 KB 2.66 KB 2.64 KB NODE_PROD
React-dev.js 0.0% 0.0% 74.44 KB 74.46 KB 18.91 KB 18.91 KB FB_WWW_DEV
React-prod.js -0.2% -0.6% 17.71 KB 17.67 KB 4.57 KB 4.54 KB FB_WWW_PROD
React-profiling.js -0.2% -0.6% 17.71 KB 17.67 KB 4.57 KB 4.54 KB FB_WWW_PROFILING

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.production.min.js -0.0% -0.0% 115.9 KB 115.9 KB 36.44 KB 36.43 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% -0.1% 3.34 KB 3.34 KB 1.26 KB 1.26 KB UMD_DEV
react-dom.profiling.min.js -0.0% -0.0% 119.58 KB 119.58 KB 37.5 KB 37.49 KB NODE_PROFILING
react-dom-unstable-testing.profiling.min.js n/a n/a 0 B 120.44 KB 0 B 38.78 KB UMD_PROFILING
react-dom-unstable-testing.development.js n/a n/a 0 B 845.36 KB 0 B 193.62 KB NODE_DEV
react-dom-unstable-testing.production.min.js n/a n/a 0 B 117.03 KB 0 B 36.92 KB NODE_PROD
react-dom-server.node.production.min.js 0.0% -0.0% 20.31 KB 20.31 KB 7.51 KB 7.51 KB NODE_PROD
react-dom-unstable-testing.profiling.min.js n/a n/a 0 B 120.72 KB 0 B 37.99 KB NODE_PROFILING
react-dom-test-utils.production.min.js 0.0% -0.0% 10.94 KB 10.94 KB 4.16 KB 4.16 KB UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 49.55 KB 49.55 KB 13.51 KB 13.51 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.68 KB 3.68 KB 1.33 KB 1.33 KB NODE_DEV
react-dom.development.js 0.0% 0.0% 882.49 KB 882.56 KB 194.45 KB 194.47 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.79 KB 10.79 KB 4.09 KB 4.09 KB NODE_PROD
react-dom-server.browser.development.js 0.0% -0.0% 134.59 KB 134.59 KB 34.59 KB 34.59 KB UMD_DEV
react-dom.production.min.js -0.0% 0.0% 115.83 KB 115.82 KB 37.06 KB 37.06 KB UMD_PROD
react-dom.profiling.min.js -0.0% -0.0% 119.35 KB 119.35 KB 38.28 KB 38.28 KB UMD_PROFILING
react-dom.development.js 0.0% 0.0% 839.83 KB 839.9 KB 192.08 KB 192.11 KB NODE_DEV
ReactDOM-dev.js 0.0% 0.0% 937.2 KB 937.27 KB 208.79 KB 208.82 KB FB_WWW_DEV
ReactDOM-prod.js -0.0% -0.0% 394.76 KB 394.75 KB 71.74 KB 71.74 KB FB_WWW_PROD
ReactDOMServer-prod.js 0.0% 0.0% 47.39 KB 47.39 KB 11.03 KB 11.03 KB FB_WWW_PROD
ReactDOM-profiling.js -0.0% -0.0% 406.05 KB 406.04 KB 73.9 KB 73.89 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 58.9 KB 58.9 KB 14.7 KB 14.7 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1013 B 1013 B 602 B 601 B NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.26 KB 10.26 KB 3.49 KB 3.49 KB UMD_PROD
ReactDOMTesting-dev.js +5.2% +5.0% 896.55 KB 943.15 KB 200.3 KB 210.36 KB FB_WWW_DEV
ReactDOMTesting-prod.js 🔺+4.2% 🔺+4.4% 381.82 KB 397.88 KB 69.46 KB 72.49 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 55.86 KB 55.86 KB 14.46 KB 14.46 KB NODE_DEV
react-dom-unstable-testing.development.js n/a n/a 0 B 888.3 KB 0 B 195.98 KB UMD_DEV
ReactDOMTesting-profiling.js +7.2% +7.4% 381.82 KB 409.17 KB 69.46 KB 74.64 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 9.99 KB 9.99 KB 3.37 KB 3.36 KB NODE_PROD
react-dom-unstable-testing.production.min.js n/a n/a 0 B 116.91 KB 0 B 37.57 KB UMD_PROD

Size changes (stable)

Generated by 🚫 dangerJS against 34baecb

@sizebot
Copy link

sizebot commented Mar 2, 2020

Details of bundled changes.

Comparing: 7e83af1...34baecb

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-unstable-testing.development.js n/a n/a 0 B 916.98 KB 0 B 200.9 KB UMD_DEV
react-dom-unstable-testing.production.min.js n/a n/a 0 B 120.81 KB 0 B 38.71 KB UMD_PROD
ReactDOMTesting-dev.js +3.5% +3.4% 870.96 KB 901.71 KB 195.14 KB 201.82 KB FB_WWW_DEV
react-dom-server.browser.production.min.js 0.0% -0.0% 20.44 KB 20.44 KB 7.49 KB 7.49 KB UMD_PROD
react-dom.profiling.min.js -0.0% -0.0% 123.67 KB 123.66 KB 38.56 KB 38.56 KB NODE_PROFILING
react-dom-test-utils.development.js 0.0% 0.0% 53.78 KB 53.78 KB 14.01 KB 14.01 KB UMD_DEV
ReactDOM-dev.js 0.0% 0.0% 895.75 KB 895.82 KB 200.25 KB 200.27 KB FB_WWW_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 10.96 KB 10.96 KB 4.17 KB 4.17 KB UMD_PROD
ReactDOM-prod.js -0.0% -0.0% 370.91 KB 370.9 KB 67.53 KB 67.53 KB FB_WWW_PROD
ReactDOM-profiling.js -0.0% -0.0% 382.12 KB 382.11 KB 69.66 KB 69.65 KB FB_WWW_PROFILING
react-dom-test-utils.development.js 0.0% 0.0% 49.56 KB 49.56 KB 13.52 KB 13.52 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.81 KB 10.81 KB 4.1 KB 4.1 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% -0.2% 1 KB 1 KB 610 B 609 B NODE_PROD
react-dom-server.node.development.js 0.0% -0.0% 130.42 KB 130.42 KB 34.65 KB 34.65 KB NODE_DEV
react-dom-unstable-testing.profiling.min.js n/a n/a 0 B 124.45 KB 0 B 39.89 KB UMD_PROFILING
ReactDOMTesting-prod.js 🔺+1.4% 🔺+1.3% 368.93 KB 374.03 KB 67.44 KB 68.31 KB FB_WWW_PROD
react-dom-unstable-testing.development.js n/a n/a 0 B 872.86 KB 0 B 198.49 KB NODE_DEV
ReactDOMTesting-profiling.js +4.4% +4.4% 368.93 KB 385.24 KB 67.44 KB 70.39 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% -0.0% 129.21 KB 129.21 KB 34.39 KB 34.39 KB NODE_DEV
react-dom-unstable-testing.production.min.js n/a n/a 0 B 121 KB 0 B 37.94 KB NODE_PROD
react-dom.development.js 0.0% 0.0% 911.17 KB 911.25 KB 199.37 KB 199.4 KB UMD_DEV
react-dom-unstable-testing.profiling.min.js n/a n/a 0 B 124.8 KB 0 B 39.05 KB NODE_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 58.91 KB 58.91 KB 14.7 KB 14.7 KB UMD_DEV
react-dom.production.min.js -0.0% -0.0% 119.72 KB 119.72 KB 38.22 KB 38.22 KB UMD_PROD
react-dom.profiling.min.js -0.0% -0.0% 123.37 KB 123.36 KB 39.4 KB 39.4 KB UMD_PROFILING
ReactDOMServer-prod.js 0.0% -0.0% 46.68 KB 46.68 KB 10.84 KB 10.84 KB FB_WWW_PROD
react-dom.development.js 0.0% 0.0% 867.33 KB 867.4 KB 196.96 KB 196.99 KB NODE_DEV
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 55.87 KB 55.87 KB 14.47 KB 14.46 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.69 KB 3.69 KB 1.34 KB 1.34 KB NODE_DEV
react-dom.production.min.js -0.0% -0.0% 119.87 KB 119.87 KB 37.45 KB 37.44 KB NODE_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10 KB 10 KB 3.37 KB 3.37 KB NODE_PROD

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react.development.js 0.0% 0.0% 107.4 KB 107.43 KB 25.69 KB 25.69 KB UMD_DEV
react.production.min.js 0.0% -0.0% 12.46 KB 12.46 KB 4.8 KB 4.8 KB UMD_PROD
react-unstable-testing.development.js n/a n/a 0 B 107.45 KB 0 B 25.7 KB UMD_DEV
react-unstable-testing.production.min.js n/a n/a 0 B 12.47 KB 0 B 4.81 KB UMD_PROD
ReactTesting-dev.js n/a n/a 0 B 73.79 KB 0 B 18.73 KB FB_WWW_DEV
react-unstable-testing.profiling.min.js n/a n/a 0 B 16.01 KB 0 B 5.9 KB UMD_PROFILING
ReactTesting-prod.js n/a n/a 0 B 17.65 KB 0 B 4.56 KB FB_WWW_PROD
react-unstable-testing.development.js n/a n/a 0 B 68.95 KB 0 B 17.97 KB NODE_DEV
ReactTesting-profiling.js n/a n/a 0 B 17.65 KB 0 B 4.56 KB FB_WWW_PROFILING
react-unstable-testing.production.min.js n/a n/a 0 B 7.53 KB 0 B 2.92 KB NODE_PROD
react.development.js 0.0% 0.0% 68.91 KB 68.94 KB 17.96 KB 17.96 KB NODE_DEV
react.production.min.js -0.4% -0.5% 7.51 KB 7.48 KB 2.91 KB 2.89 KB NODE_PROD
React-dev.js 0.0% 0.0% 73.76 KB 73.79 KB 18.73 KB 18.73 KB FB_WWW_DEV
React-prod.js -0.2% -0.6% 17.65 KB 17.61 KB 4.56 KB 4.53 KB FB_WWW_PROD
React-profiling.js -0.2% -0.6% 17.65 KB 17.61 KB 4.56 KB 4.53 KB FB_WWW_PROFILING

ReactDOM: size: n/a, gzip: n/a

React: size: 0.0%, gzip: -0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against 34baecb

@threepointone threepointone force-pushed the oss-test-builds branch 3 times, most recently from c5a591c to f0102aa Compare March 3, 2020 00:06
@@ -792,7 +790,7 @@ function runActTests(label, render, unmount, rerender) {
}
});
describe('warn in prod mode', () => {
it('warns if you try to use act() in prod mode', () => {
xit('warns if you try to use act() in prod mode', () => {
Copy link
Contributor Author

@threepointone threepointone Mar 3, 2020

Choose a reason for hiding this comment

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

I could probably remove this test. Or rewrite it to run across the dev/prod+testing matrix. Thinking about options, not blocking a review.

@threepointone threepointone changed the title WIP: Bring back OSS testing builds Testing builds Mar 3, 2020
@threepointone threepointone marked this pull request as ready for review March 3, 2020 02:33
@threepointone threepointone force-pushed the oss-test-builds branch 3 times, most recently from 50ba7e1 to 58400f6 Compare March 4, 2020 10:51
We removed this in facebook#18138 to unblock 16.13. This PR brings it back, with some changes -
- testing builds are prefixed with `unstable-`, i.e - `react-dom/unstable-testing`
- added back to `bundles.js`
- introduces the `__TESTING__` global. Not used to generate the actual builds, but is used for test specific logic
- flushes suspense fallbacks in prod for testing builds
- changes tests in TestUtilsAct to reflect this
- adds a testing build for `react` as well
- and finally removes the testing sigils from prod builds. nice.
- misc test config changes
@@ -962,7 +962,7 @@ function mountEffect(
): void {
if (__DEV__) {
// $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
if ('undefined' !== typeof jest) {
if (__TESTING__ || 'undefined' !== typeof jest) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will "fix" #15439

@@ -0,0 +1,10 @@
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file may be unnecessary. 🤔

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.

The current approach will disable all warnings (except the act ones that you've modified) in the testing build, which I don't think is what we want. Do you have a plan for those? I don't think we can land this until we solve that.

@@ -789,7 +789,7 @@ function finishConcurrentRender(
hasNotProcessedNewUpdates &&
// do not delay if we're inside an act() scope
!(
__DEV__ &&
(__DEV__ || __TESTING__) &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need a plan for all the other warnings. Do we need to update all the other warning guards, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don’t think we have to change anything?

@threepointone
Copy link
Contributor Author

I don’t understand, how would this setup disable warnings? You’d see CI to break badly if that was the case.

The act one I modified makes it so the fallback behaviour is the same in prod (but only in testing builds).

@eps1lon
Copy link
Collaborator

eps1lon commented Jul 11, 2020

Has this been abandoned? I was a bit confused why I didn't get missing act warnings until I found out that these are only enabled for jest. Naively I wanted to propose to check NODE_ENV:

-if ('undefined' !== typeof jest) {
+if (process.env.NODE_ENV === 'test') {

which is set by jest as well (by default) but this is somewhat controversial.

If you still intend to ship extra testing builds (which I prefer over mocking scheduler) I'd like to help. Seems like this PR "only" needs to be updated with master?

@sebmarkbage sebmarkbage deleted the branch facebook:master October 20, 2022 20:41
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.

6 participants