Last updated
on 02-09-2012
at 12:00 AM

Blog

In the process of writing one awesome project (a story for another post), I found it was actually quite tricky to run JavaScript tests (here QUnit tests, to be specific) cleanly without a browser, particularly in a headless environment (i.e. for continuous integration). Clearly, this immediately needed fixing!

To this end, I’ve written a project I’m imaginatively calling Js-Test-Runner, which has just gained a version 0.1 release. This provides an extremely simple super-duper lightweight and easy test runner for JavaScript tests, in a way that should ‘just work’ for 90% of cases with absolutely no faff. Install the deb (RPMs are en route), add ‘js-test-runner test-file.html -o js-test-results.xml’ to your build script, and have Jenkins take a look at the resulting js-test-results.xml file.

Future plans include making it more useful for direct manual runs (i.e. adding some useful command-line output and making XML output optional), adding support for Jasmine, a cool little BDD test framework that looks like fun, and providing RPM (and possibly Windows) binaries. In the meantime, it’s entirely workable, and is already effectively running the tests for my other project for me now. Problem solved!