Skip to content

The Story (as told by jejacks0n)

jejacks0n edited this page Jun 16, 2013 · 9 revisions

There are some great resources out there for testing Javascript these days, and many of them integrate nicely with Rails.

Over the past 4 years though this hasn't been entirely true, and we've changed test runners no less than 4 times in as many years. There was blueridge, and then we used jasmine-rails, and Evergreen, and finally Jasminerice. While each of these were/are good projects (and their development much appreciated), there was always some feature that we wanted and weren't able to get into the projects -- I've tried to / contributed to no less than three of the projects mentioned.

At the end of the day though, some problems still remained. Most of the libraries were either too simplistic in nature (only allowed running from the browser), or were too complicated -- using guard etc. and most focusing on only one test framework.

I had these desires:

  • Great Rails asset pipeline support.
  • An easy way to run tests on CI.
  • The ability to group tests into suites.

Teaspoon was born of the desire for solutions to those things, and while I worked on it I realized a few things.

  1. Javascript tests should be more like how we write and wire up our ruby specs.
  2. If you make it easy to run on the command line, it will naturally work well on CI.

On a tangent, one library worth noting is Konacha, which we stumbled across only after Teaspoon was mostly done. In hindsight I wish I would've been able to give Konacha a try before starting Teaspoon -- either way I could instantly see the correlations between what Konacha is trying to solve and the issues I wanted to address as well. It's a good project worth checking out.

I want to get people thinking about these problems. I want Javascript to be a first class citizen in Rails, to be tested well (and easily), and it's headed in that direction. I want any project that's helping that to be recognized and either taken from, or contributed to. In a standards friendly way so I don't have to rewrite half of my specs every time one of the projects falls by the wayside.

The thing that had initially spawned Teaspoon was that Evergreen dependencies were out of date, and the project was no longer maintained. I had specifically been looking for Jasmine solutions because I was trying to update a project that has a ton of Jasmine specs, and was important to have running on CI. I wasn't thrilled with any of the existing prospects. It wasn't until after I started on the project that I played around with Mocha (being delightfully surprised), so we added support for it. QUnit was added near the end to help match a more TestUnit sort of practice.

Alternative Projects

There it is.. and here's a list of other projects worth investigating. If I missed one please let me know.

I recently found out that Jasminerice was no longer maintained, so I decided to contribute to the project -- it's what I was using for a while, and while I think Teaspoon takes a considerably better approach (that allows for running one off files, etc.), I think it's good for the community to have options.

If you want something simpler than Teaspoon, I would suggest you check out Jasminerice.

I've recently offered to help maintain the project.

Others