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

Consider providing a UMD build for TestUtils again #11111

Closed
gaearon opened this issue Oct 5, 2017 · 13 comments
Closed

Consider providing a UMD build for TestUtils again #11111

gaearon opened this issue Oct 5, 2017 · 13 comments

Comments

@gaearon
Copy link
Collaborator

gaearon commented Oct 5, 2017

I noticed we stopped providing it, but a bunch of fiddles for old bugs use it.
I wonder if we should add it back, e.g. as react-dom-test-utils.development.js.

Let’s hear what people have to say.

@andiemmadavieswilcox
Copy link
Contributor

@gaearon: I'm currently blocked on upgrading our application to React 16 due to the lack of a UMD build of TestUtils. Shall I compile one and submit a PR?

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 20, 2017

Can you describe your use case in more detail? Why do you need a UMD build of something intended only for testing?

@markboyall
Copy link

markboyall commented Nov 20, 2017

Our application is non-trivially large, and module systems that involve transpiling our JS are unworkably slow. We used to use Webpack but cut it because it was taking 40 seconds plus for every development build (after Typescript as well).

We have no choice but to use UMD if we don't want to wait multiple minutes every time we make any script change in development.

@andiemmadavieswilcox
Copy link
Contributor

What @markboyall said 👍

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 20, 2017

OK that sounds reasonable. Happy to take a PR.

@andiemmadavieswilcox
Copy link
Contributor

@gaearon: done (#11599) 👍

@the-spyke
Copy link

Any workarounds for using .renderIntoDocument() in tools like CodePen with react@16?

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 27, 2017

All renderIntoDocument does is create a div and call ReactDOM.render into it.

var div = document.createElement('div');
ReactDOM.render(<App />, div);

Just use it directly.

@the-spyke
Copy link

What about Simulate?

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 27, 2017

In general I recommend simulating real DOM events instead of using Simulate API.
For example, if the node is in a document (that's important!):

node.dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}));

But again, as per feedback in this issue, we'll add a UMD build for TestUtils in later versions again.

@the-spyke
Copy link

Didn't saw this recommendation in React Docs. Thank you.

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 27, 2017

Yep, we'll need to document this. I'll file an issue for the doc repo.

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 27, 2017

Filed reactjs/react.dev#352.

Ethan-Arrowood pushed a commit to Ethan-Arrowood/react that referenced this issue Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants