Hacker News new | ask | show | jobs
by misiti3780 3487 days ago
I have used jest and i have used mocha. I use mocha because I got sick of having to "unmock" everything in jest tests. People have complained that jest is slow, that was never a problem I encountered.

The unmock becomes very annoying after a while.

3 comments

When jest was first released, it was incredibly, glacially slow, buggy, poorly documented, and seemed to be largely unmaintained. Critical features were broken and stayed broken for months. I was an early adopter and I got burned hard, having to rewrite everything in Mocha.

Since then, apparently, it has changed hugely, and is now fast, reliable, and pleasant to use. Or so I've heard; I have no particular reason to change back to jest, since mocha is fine.

But if you're wondering why you've heard about it being slow, it's because for many, many months jest was absurdly, unbelievably slow; simple "hello world" tests would take seconds, and even a medium projects would take minutes. And there was no watch mode, nor any ability to re-run failing tests, or re-run tests on changed files. It was absurd.

Edit: See, eg, https://github.com/facebook/jest/issues/116 opened 8 Aug 2014, and finally closed 17 Feb 2016. Quite a run.

Also, there were tons of bugs with the mocking and, especially, the `dontMock()` methods; many things could cause attempts to turn mocking off to silently, invisibly fail (or even more fun, to cause an attempt to disable mocking on one item to cause it to be silently, invisibly disabled on all items). It's amazingly hard to track down a failing test when a bug triggered by code in another test can cause items that should be mocked to not be mocked, and visa versa.

Jest has changed a lot lately. Back in September they changed the mocking to be opt-in. [1]

The speed is also very much improved!

[1] http://facebook.github.io/jest/blog/2016/09/01/jest-15.html#...

I always used the option to turn it off by default. What you're left with (instead of having to unmock loads of stuff) is a parallel test runner with and a utility that is capable of mocking most anything upon command.

They recently changed mocking to be opt-in.