- A Sad State of Affairs
- Searching for Testing Tools
- Enter Konacha
- Installing Konacha
- Writing Your First Test
- Running the Test Suite
- Going Headless
- Wrapping Up
Searching for Testing Tools
During my hunt for great tools, I realized some things. First, JavaScript/CoffeeScript testing tools are much better than I thought they were. Some absolutely fantastic tools are out there—a few of them even better than their Ruby counterparts. Second, I found that these tools are easy to set up, configure, and run.
One of the most prominent tools for testing JavaScript and CoffeeScript applications is Jasmine. Modeled after the popular Ruby testing framework RSpec, Jasmine is a great tool, and I've used it successfully on a number of projects. I even wrote a chapter about it in my book Programming in CoffeeScript. It's easy to use. However, when working with Rails applications, Jasmine is fairly cumbersome to set up. A few gems out there, most notably Evergreen, try to make it easier to set up Jasmine with your Rails application. But none of these gems were well written, and most are fairly out of date.
Evergreen, for example, doesn't play nicely with the asset pipeline. It doesn't let you pull in particular parts of the pipeline easily. Nor does it allow you to add your own "support" files just for testing. It also doesn't give you the ability to run an individual spec, which can be very useful when you're practicing test-driven development.
After plenty of experimentation, frustration, and sheer terror, I finally found something that made all of my JavaScript testing dreams come true.