Jasmine vs Mocha. But why?
View this email in your browser

Howdy folks,

Welcome to issue #2 of Front-end Testing Weekly. I meant to send this out Thursday, but I didn't, so I'll blame my 2-year-old son for taking up all my time.

I've been mulling over the best format for this and how to provide the most value for the least amount of effort on your part.

The best idea I've had so far is to provide three parts: a concise review of an article or tool, a question of the week, and a list of the week's @frontendtesting links. I'm going to try this format for now and we'll see how it goes.

As always feedback is welcome!

Jasmine vs. Mocha. But why?

This week @frontendtesting shared a post that compared Jasmine and Mocha, two popular JavaScript unit test libraries. It was a great post with lots of detailed information, but it missed mentioning one thing I think is important.

Technically, the frameworks share a lot in common. They have a similar syntax and provide a lot of the same functionality. The important difference for me is how opinionated they are.

Jasmine is quite opinionated, meaning it makes a lot of choices for you. Mocha, on the other hand, leaves those decisions up to you. 

Usually I hear "opinionated" and think of a negative association. The idea that something or someone doesn't want you to be free to make your own choice. Maybe that's why I prefer Mocha.

But I really don't think Jasmine's opinion is a bad thing. If you're just starting with testing, it can be great not to have to figure out what the right choice is. You just learn the syntax given to you and get on with it.

It can also be better when introducing testing to a team. Instead of bikeshedding which syntax is better, you just use what the fine folks of Jasmine chose. Plus, newcomers to the team don't have to find the specific `expect` or `assert` documentation on the Chai page (if you use that assertion library) to figure out how to write their tests.

Sometimes choice is a great thing. Sometimes it's not the best. Be smart when making choices so you don't have to make too many :)

The Question of the Week

There is no QotW this week, because this is the first week to try it out.

If you or a loved one has a question about Frontend Testing, send it in to questions@frontendtesting.com (or just reply to this email). 

This Week's Tweets

Don't forget the Slack Channel!

You probably haven't joined the Front-end Testing Slack channel yet, have you? C'mon, join the conversation, it's free!

Share
Tweet
Forward
Copyright © 2016 Kevin Lamping, All rights reserved.


Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list

Follow Frontend Testing
Check out the barebones website