5 ms·
>Overall, developers are not happy about JavaScript testing. This is because of the low percentage of devs in the survey who have used Jest. I can't begin to d
by pauljaworski 10y ago
>Overall, developers are not happy about JavaScript testing.
This is because of the low percentage of devs in the survey who have used Jest. I can't begin to describe the joy of finally finding a JS test utility that just works and doesn't require a giant configuration file.
If you aren't using Jest, make the switch now! It's likely a lot of your existing tests will work with Jest.
- timdorr 10y agoTotally agree. Just switched to it on Redux and this was all that was involved: https://github.com/reactjs/redux/pull/1951/files https://github.com/reactjs/redux/pull/1951/files Most of that is just find-and-replace kinds of changes. But we dropped 3 dependencies to one and sped everything up in the process. It's just a fantastic tool! I finally feel like I've got a good Rspec equivalent in the JS world.
- pauljaworski 10y agoI noticed that! I often refer to the Redux docs for examples and was glad to see you had also switched to Jest. You guys have some of the best documentation around, by the way. I wish you did the docs for Flow and Immutable as well! They could use some major improvement.
- solidr53 10y agoI used Jest early on, it was nice, but I quickly started to encounter problems related to how new it was. It's way better now, so maybe I will switch back to Jest from enzyme.
- crucialfelix 10y agoThe only things I found really annoying ... Completely disappeared in the last major update. Very clean to work with now.
- cpojer 10y agoYou can use Jest together with enzyme! We posted a big community update together with Jest 16 which should highlight a bunch of ways that you can test with Jest. https://facebook.github.io/jest/blog/2016/10/03/jest-16.html https://facebook.github.io/jest/blog/2016/10/03/jest-16.html
- rajington 10y agoI love Jest, but thought the 59% satisfaction with Jest was unfortunate... probably super-early adopters?
- shados 10y agoJest used to be very meh. Also, Jest by default would cater to more "purist" unit testing. Everything mocked, everything isolated, runs in node, no browser. A lot of people in the frontend world equates unit testing with Selenium tests (aka: integration tests) and get really ruffled/confused by "pure" unit tests. Now Jest changed the defaults to what most people expect, which will confuse them less, I suppose.
- mmmpop 10y agoCan Jest run concurrent tests? I'm using Tape as of late and I find myself having too many long-running functional tests in series but it doesn't seem to be something I can work around.
- shados 10y agoYes, yes it can. And because it can isolate tests and reset the environment, you don't really have to be (very) careful about what you do in your tests so order doesn't matter. It makes it really hard to fail there.
- cpojer 10y agoHey! I'm Christoph and I work on Jest. We wrote a blog post about how we are making Jest fast: facebook.github.io/jest/blog/2016/03/11/javascript-unit-testing-performance.html If your test is fully CPU bound and limited to one core, it probably won't be faster with Jest. If you split it up across multiple files, it will parallelize tests.
- ggregoire 10y agoThe survey should separate unit testing and e2e testing. I don't know what the general feeling about e2e testing in the JS community, but in my last job we had to write, fix and maintain hundreds of e2e tests and it was a nightmare. Our stack was Angular 1 and the de facto Angular e2e tool, Protractor. We wrote tons of helpers, like waitToBeVisible & waitToBeHidden, most of them copy/pasted from StackOverflow because every users of Angular and Protractor have the same basic troubles and use the same workarounds, and we had to use those helpers in every test. Also I can't imagine the number of hours spent to mock our Angular services + MySQL/Redshift data, to spy the functions who manipulate url/cookies/localStorage/etc and to write some "page objects" to make the tests readable. In my opinion: The benefits of the e2e tests are too small to justify the crazy amount of time spent to make the new tests work and maintain the existing ones. Most of the time, the tests break because someone has changed something in the DOM or renamed a CSS class or modified an external API and forgot to update the tests/mocks. But they almost never break for a regression... so what's the point? Or otherwise you need a dedicated team with 1 or 2 engineers (for a small/medium company) working full time on the e2e. (PS: I used only Protractor with Angular 1. I haven't tested the other tools like Nightwatch.js, and I don't know what they have done for Angular 2 (Protractor 2?). Now I develop in React and just do unit testing & dog fooding).
- pauljaworski 10y agoYeah, I've been putting off e2e testing while I pray for a decent tool to come out before I really need it. I think the benefits come when you're really making use of reusable components. I have about 20 views that all make use of the same Redux container component, and e2e tests would definitely help me sleep better at night.