ctrlplusb / react-universally

A starter kit for universal react applications.
MIT License
1.69k stars 243 forks source link

Should jest be in by default? #277

Closed ctrlplusb closed 7 years ago

ctrlplusb commented 7 years ago

It feels like it is starting to win the test framework "wars".

It would be great to have a test framework baked in as it gives us the opportunity to put tests around critical parts of our toolchain and helpers etc.

Thoughts?

Ping... @carsonperrotti @codepunkt @enten @strues @bkniffler @lucianlature

But welcome feedback from everyone!

enten commented 7 years ago

Maybe you should wait to be satisfied by the file structure and the toolchain before start to write tests.

It feels like it is starting to win the test framework "wars".

Why do you think that? Why jest is better than others?

ctrlplusb commented 7 years ago

I take it you haven't used it yet then 😁

In all seriousness it is amazing, some of its highlights:

In general it makes testing far less painful. Which is so important, because if we are afraid of writing tests in the first place we definitely won't write them as much as we should.

Note: I am previously a mocha, chai, sinon, jsdom fan. And used a host of other libs for reporting and code coverage. It's great that I get everything I need now with a single framework install.

Try it out for a day. Especially the watch mode and snapshot testing of your react components. It's awesome.

P.S. snapshot testing isn't limited to components. You can snapshot test anything. Objects, strings, whatever. It's a useful form of testing that introduces a code review system into your codebase and removes the need for tests to do heavy "expected" boilerplates that depend so much on internals and therefore are so brittle to changes and cumbersome to upgrade.

strues commented 7 years ago

I prefer Jest to Ava. I really prefer Jest to setting up Mocha / Chai / Sinon

bkniffler commented 7 years ago

I'm all for using jest as a core feature, and I don't think this is too early. Integrating it into react-universally may seem like a sacrifice in flexibility, but then again it currently seems like the superior framework compared to its competitors and it is backed by the react team.

Testing is a hugely important part of web app development and I think a lot more people would bother about writing tests if they had a straight-forward starting point inside their boilerplate. People who really know what they want can still kick jest out and replace it by mocha, sinon, jsdom, whatever.

codepunkt commented 7 years ago

I don't have a lot of experience with Jest, but based on what i did with it so far, i'd like to have it included as a core lib!

strues commented 7 years ago

I'll begin writing real tests if we move forward with implementing Jest project-wide. If I recall correctly, the implementation branch, had only a handful of cheat tests.

ctrlplusb commented 7 years ago

Staged on next