Closed ctrlplusb closed 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?
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.
I prefer Jest to Ava. I really prefer Jest to setting up Mocha / Chai / Sinon
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.
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!
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.
Staged on next
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!