top | item 10621561

(no title)

dmatteo | 10 years ago

As you can see from the article, this is not truly a comparison between Karma and Mocha, but I wanted the title to be intentionally provocative, to sparkle some discussion around the topic :)

We use test-automation for real browser testing but prefer to rely on quick and functional unit-testing, thus the choice to go with jsdom.

Regarding the community, you're right, there's a `karma-something` for every need. However, mocha is pretty popular too, and getting momentum by the day. Also the fact that it simply runs on Node makes it quite easy to obtain what you want without extra plugins (e.g. coverage).

discuss

order

EvanPlaice|10 years ago

"wanted the title to be intentionally provocative"

Click bait adds no value to the discussion.

There's no either/or when it comes to karma/mocha. As the commenters above mentioned, it's best to use both. Mocha for quick unit testing, karma for in-browser testing.

In-browser testing can be automated to run on a wide range of browsers and platforms using integration tools such as Browser Stack.

By faking the DOM, you remove nerf the greatest advantage of client-side integration testing. Checking functionality under realistic circumstances.