facebook / create-react-app

Set up a modern web app by running one command.

Home Page:https://create-react-app.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider waiting with `react-test-renderer` until it is ready?

KnutHelland opened this issue · comments

I can see react-test-renderer is included in the 0.3.0-alpha.

I tried the react-test-renderer first time today, and it hasn't been a friction-less experience so far. Are you sure that react-test-renderer is ready to be exposed to beginners?

See my other issue on react requesting documentation for react-test-renderer: facebook/react#7431

commented

I totally agree it needs more work. Can you compile a list of issues that you think are blockers for recommending it?

I still plan to ship Jest this week but I think we’ll downplay the snapshot testing part in the announcement, so that people can use the tools they’re comfortable with (like Enzyme) while snapshot testing issues are being solved.

commented

Oh, facebook/react#7431 is a good reference:

  • The injectEnvironment called twice bug facebook/react#7386
  • The fact that refs is just null when rendered with react-test-renderer facebook/react#7371
  • When setting a ref on a dom element, React erroneously warns about stateless function components cannot be given refs. (also probably related to facebook/react#7371)

We’ll want to have solutions/workarounds to these before recommending it.

cc @cpojer

commented

(The good part is that all of those issues are in react-test-renderer itself so it should be possible to update it independently from CRA.)

commented

FYI we’re going to release Jest integration now but downplay snapshot testing until it’s more polished.

commented

Closing, as we’re downplaying it in the docs, and will eventually highlight it when it’s more mature.

In case it helps anyone, I've found using enzyme + enzyme-to-json to be a fantastic alternative renderer for snapshot testing

commented

Snapshot rendering should actually be pretty stable / useable after React 15.4.1.
See this post for more info.