Matthew Seeley and I have been building an AngularJS app using Yeoman. So far it’s been great! Yeoman gives you Grunt tasks, AngularJS generators,
and Bower package management right out of the box. In addition, it gives you a base configuration
for running Angular tests with Karma.

Unfortunately we ran into a situation that brought our productivity to a screeching halt. Our tests written in CoffeeScript
were not executing. After a some investigation, we found found a solution to this problem.

Re-Configuring Karma

A configuration file is used to tell Karma how to execute the test suite:

./karma.conf.js

By default karma.conf.js has a section which describes the files that load
for the test execution. It looks something like this:

With this configuration, the compiled CoffeeScript files were left out of our test suite. To fix this we modified
this section to include the compiled javascript files in the .tmp directory:

During the grunt coffee task, our CoffeeScript files are compiled to JavaScript and placed into the .tmp
directory. By adding the .tmp directories to our karma.config.js file, the test suite includes
the files that we meant to test in the first place, and they all passed!

technology logo

Get a Free Consultation

Your Free Consultation will be packed full of discussions, brainstorming, and hopefully, excitement. The meeting is designed to help uncover your challenges, define your needs, and outline possible solutions so you can make decisions that will lead to the business outcomes you desire.

Free Webinar & Guide

Digital Tranformation
A simple guide to uncover the potential impact digital transformation can have on your organization