Hacker News new | ask | show | jobs
by wildpeaks 3487 days ago
Jest sounds good on paper, it's great it exists and it definitely has potential and even improved a lot recently (and I usually try every new version that come up), however I have two pain points with it that prevent me from switching to Jest for now:

- 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".

2 comments

Hey there, frequent Jest contributor here! Globs are under consideration (there's an issue from a collaborator on the subject.)

FWIW, Jest is insanely good. I've been using it for almost 2 years now through some of the rougher patches in its development and man, it's an extremely well thought-out system with a team of highly motivated maintainers. Facebook uses it for almost all their JS projects, so it gets a LOT of attention and TLC.

Many things that were poor defaults have been changed since v17, like getting rid of auto mocking. It's worth a look again.

I work on Jest at FB.

* I agree regexes suck but that's all we had five years ago when it was started. Would love to move to a glob system incrementally but most of that will have to come from the community. I'm also still concerned about performance. We match things against tens of thousands of files a lot and regex seems strictly faster to me but I'm happy to be proven wrong or shown that it won't be relevant. * There is one minor issue with create-react-app's recommended use of node_modules to split up things. I would recommend lerna for multi-package development ( https://github.com/lerna/lerna ) and we are hoping to put whatever fix in place here that will work well. There are workarounds but they aren't great.

node-glob was released in 2010
Thanks! That's great. Maybe you can help us upgrade then? Jest is fun to contribute to.