Javascript testing using Wallaby.js

Originally written on

Wallaby.js is insanely fast, because it only executes tests affected by your code changes and runs your tests in parallel.

Wallaby.js is a test runner for JavaScript, it can be integrated in most common code editors/IDE and it provides a productivity boost whether you are doing TDD and BDD.

Wallaby.js is not free, but it is less expensive than some similar commercial solutions for other languages.

The power of wallaby.js

The power of Wallaby.js is the integration between tests and code editor: it reports code coverage and test results and error while you’re writing code. Wallaby.js supports a lot of technologies, you can find a lot of samples and templates on github account.

Supported technologies

Wallaby.js supports continuous testing in most common code editor: Sublime text, Atom, Visual studio code, Visual Studio 2013/15 and WebStorm.

It supports browser code testing (via PhantomJS or node.js) and node.js testing, it also supports many testing frameworks, for example: Jasmine, Mocha, QUnit. Finally, tests can also be written using TypeScript or CoffeeScript.

Installation and Configuration

Wallaby.js can be installed as an extension of your code editor: for example, in VS Code you can simply install using extension manager:

Javascript testing using Wallaby.js needs a configuration file to work, recommended names are wallaby.js/wallaby.json or wallaby.conf.js. The following code shows some simple configuration options:

Here’s the complete list of configuration options.

In my opinion..

Keep in mind, Wallaby.js is not a file watcher: File watcher would run all of your JavaScript tests and it can be very time consuming. Wallaby uses dependency analysis and other tricks to only run tests affected by your code changes, no more no less, so even in large codebases with lots of tests the feedback is delivered very fast.

I have tried Wallaby.js on two IDE: Visual studio 2013 and WebStorm 11. It has improved my TDD workflow, I think it’s very useful because it can jump to failing test, error sources, show error details inline. It has also been easy to import my testing code written on Mocha and Chai.

Cheers :)