Simple Karma Task for Gulp


The other day I could not find an acceptable Karma task for Gulp, so I spent some time on my own. Using Karma ~1.3.0 and Gulp ~3.9.0.

process.exit will stop the task, preventing weird error messages from Gulp. I think Karma calls the complete method for each test file? I don’t know, either way it makes the two dance well together.

One more thing, just a warning do not refactor the last task to match.

var karmaServer = new karma.Server({
    configFile: __dirname + '/test/karma.conf.js'
}, done).start();

There is an integration problem where Gulp will try to read the arguments sent into the done() method. More about this pestering issue here.

Related Posts

Why I Regret Switching from Jekyll to Middleman for My Blog

Pick Random Item Based on Probability

Quickest Way to Incorporate in Ontario

Creating Chinese Study Decks

Generating Better Random Numbers

Image Magick Tricks

My Game Dev Process

Unit Manager Code Snippet

Recommended Game Dev Reading

Healthbar Code Snippet