Why does rwjblue like Qunit so much more than Mocha?

We know rwjblue loves manipulating X12 structures using native Ruby syntax, but do you know why he much prefers Qunit to Mocha?

1 Like

rwjblue has weird tastes. He also doesn’t like TypeScript


I’ve been using Mocha for a while on my main client project. I think I like QUnit’s test runner quite a bit more. Isolation is easier, disabling try/catch is easier, and the syntax is now very similar to Mocha as far as nesting is concerned.



What a blast from the past! That was a really fun project though…

As this is generally a personal preference question, I’ll just right into it:

Mocha uses exceptions to manage assertions, whereas QUnit manages assertions independently from exceptions. The result here is that in QUnit you can disable “try-catch” for a given test, and get a proper “break on exceptions” breakpoint right at the location of an error (the same is not possible for Mocha). Additionally, you can see all assertions regardless of an early assertion failure (in Mocha you would only see up to the first failed assertion). I also like the QUnit runner quite a bit better (though Mocha’s reporting of assertion failures is still a nicer).

In addition, there is a non-trivial amount of “safety” that you gain by using the default stack. This blog post has a pretty nice writeup on that concept. This isn’t inherently an endorsement of QUnit per-se, but it does explain why its generally best to stick with the default stack.

Ultimately, both ember-qunit and ember-mocha provide very nice testing environments and you should pick whichever works best for you. I still strongly believe that QUnit is the best choice for the default stack, but I believe even more strongly that the Ember ecosystem should enable and empower users to use whichever testing framework they prefer. The recent work on the layers of abstraction in the testing frameworks should (hopefully) attest to that…

It really shouldn’t matter what I like or dislike, it should only matter what works best for the ecosystem as a whole. The thing I care the most about is productivity (including in testing), all other choices are a byproduct of that (and subject to possible change)…


I used to pretty strongly prefer Mocha to QUnit, but at this point all the former advantages of Mocha are things QUnit can also do well (like nesting modules, or having a good out-of-the-box node test runner). And I have come around to appreciating Rob’s point about not using exceptions to implement assertions.


Amazing! Thanks all!

1 Like