-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
Testing builds #18196
Conversation
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:
|
Details of bundled changes.Comparing: 7e83af1...34baecb react
react-dom
Size changes (stable) |
8f01a08
to
45f5a6a
Compare
Details of bundled changes.Comparing: 7e83af1...34baecb react-dom
react
ReactDOM: size: n/a, gzip: n/a React: size: 0.0%, gzip: -0.0% Size changes (experimental) |
c5a591c
to
f0102aa
Compare
@@ -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', () => { |
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.
I could probably remove this test. Or rewrite it to run across the dev/prod+testing matrix. Thinking about options, not blocking a review.
f0102aa
to
24b073d
Compare
24b073d
to
89f7955
Compare
89f7955
to
1a15111
Compare
50ba7e1
to
58400f6
Compare
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
58400f6
to
34baecb
Compare
@@ -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) { |
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.
this will "fix" #15439
@@ -0,0 +1,10 @@ | |||
/** |
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.
This file may be unnecessary. 🤔
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.
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__) && |
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.
We need a plan for all the other warnings. Do we need to update all the other warning guards, too?
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.
I don’t think we have to change anything?
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). |
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 -if ('undefined' !== typeof jest) {
+if (process.env.NODE_ENV === 'test') { which is set by 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 |
We removed this in #18138 to unblock 16.13. This PR brings them back, with some changes -
unstable-
, i.e -react-dom/unstable-testing
bundles.js
__TESTING__
global. Not used to generate the actual builds, but is used for test specific logic.testing
forks ofReactFeatureFlags
react
as well