by huan9huan on 12/8/16, 3:13 AM with 61 comments
by orta on 12/8/16, 10:20 AM
by rileyt on 12/8/16, 5:47 AM
Over the past few months, that has changed entirely. Improved speed, lots of bug fixes, snapshot tests and general ease of setup with React projects have all really helped.
Jest is now the test framework I would suggest for anyone starting a new React project.
by wwalser on 12/8/16, 4:59 AM
This isn't commentary on the quality of Jest. After turning off auto-mocking and instead only using the mocking when I really needed it, I ended up using it for a moderately successful side project and enjoyed the experience.
by jcoffland on 12/8/16, 7:12 AM
by haney on 12/8/16, 4:38 AM
by franciscop on 12/8/16, 4:09 PM
Before I was mangling with Grunt and PhantomJS, but due to PhantomJS version being back ages I couldn't really test ES6 so I had to do a hybrid and running mocha in an actual browser, and the rest of the dev stack in grunt. Now I am able to do it all automatically. Not only that, but jest includes a browser by default which supports ES6 and an assertion library, so just with 'jest' I am doing the same that I did before with mocha, chai and PhantomJS (+ the pain of installing PhantomJS separately).
I am not so much into React, but I just fell in love with Jest. Testing will be something totally different from now on, thank you Facebook.
[1] http://github.com/franciscop/superdom.js
PS, it was a bit more difficult to integrate Jest into Grunt and I get it without the colors, but I'm sure I'll find a solution soon-ish.
by wildpeaks on 12/8/16, 6:05 AM
- it uses regexes instead of globs, so you can't just give it the list of tests like you would with Mocha or electron-mocha (e.g. something like "jest src/* * /*.tests.js")
- it excludes paths that include "node_modules" and it's not just a default (which would be fine), it's hardcoded, so you can forget about local modules, or dependencies that use local modules
Fortunately, there are already open issues for both, so that might improve in the future :)
---
Edit: I had to add extra spaces in the glob example (so it's slightly incorrect) because HN formatting seems to prevent using "double star".
by BJanecke on 12/8/16, 1:23 PM
But
Jest has gotten a whole lot better over the last few months. It used to be slow, cryptic and dogmatic. Now it's fast, transparent and open to debate.
Great job Jest team!
I would qualify that but I started this comment saying it was going to be frivolous. If enough people care however I'll expand on this.
by misiti3780 on 12/8/16, 4:30 AM
The unmock becomes very annoying after a while.
by spraak on 12/8/16, 12:20 PM
1. What good books (or repos) that use JS can you recommend for writing good tests?
2. What advantages does Jest have over Jasmine?
by CoryG89 on 12/8/16, 12:56 PM
Looks like jest tries to cover all three.
by batmansmk on 12/8/16, 5:29 AM
by efrafa on 12/8/16, 6:40 AM
by petetnt on 12/8/16, 7:34 AM
by kybernetikos on 12/8/16, 11:14 AM
The painlessness comes with a cost.
by Nitramp on 12/8/16, 5:07 AM
by aikah on 12/8/16, 9:17 AM
by krrkrrmjao on 12/8/16, 11:40 AM
by gondo on 12/8/16, 12:50 PM