Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTony Brackins
28,766 PointsMocha vs Jasmine?
Just wondering why we're using Mocha and not Jasmine as I've heard Jasmine is the standard.
Thanks!
Roger Hwang
3,851 PointsThe great debate begins after popping open another can of worms! Too many choices like a supermarket. I'd say just learn any testing framework to understand its general concept from the start instead of getting into an analysis paralysis debate on frameworks.
1 Answer
Adam Fields
Full Stack JavaScript Techdegree Graduate 37,838 PointsUpdated article for 2017: https://medium.com/powtoon-engineering/a-complete-guide-to-testing-javascript-in-2017-a217b4cd5a2a
TL;DR:
In short, if you want to βjust get startedβ or looking for a fast framework for large projects, go with Jest. If you want a very flexible and extendable configuration, go with Mocha. If you are looking for simplicity go with Ava.
Adam Fields
Full Stack JavaScript Techdegree Graduate 37,838 Points2019 Update: We still use Mocha at work for all of our back-end NodeJS services. It gets the job done, but lacks the developer experience you get from more modern testing frameworks. Since our front-end is AngularJS/Angular, we use the Karma/Jasmine combination that is the standard within the Angular community. Outside of work, I've moved towards Ava (with Supertest) for back-end unit testing as it includes really simple assertions, is lightweight, and supports TypeScript out of the box. For front-end, I prefer Jest for testing React/Vue components and Cypress for end-to-end testing.
Alecia Mason
1,949 PointsAlecia Mason
1,949 PointsGreat article about the two:
http://thejsguy.com/2015/01/12/jasmine-vs-mocha-chai-and-sinon.html