Server-side testing of browser dependent JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Browser Test

Server-side testing of browser dependent JavaScript.

Write page-based javascript tests using a framework such as mocha or jasmine. Browsertest uses node and a headless browser (zombie.js) to load the test page and inspect the results.


debian linuxes (ubuntu etc):sudo apt-get install libnotify-bin (for notifications)

npm install

If you get errors installing zombie.js see their website.

npm link

(change to your project directory)

npm install browsertest


The browsertest module exposes a single function, browsertest, which accepts an 'options' object such as:

    url: 'file:///home/liam/work/browser-js-testing/tests.html',
    failedMessage: 'something broke',
    pagePredicate: function (browser) { // browser is a zombie.js browser
        return { 
            result: false, 
            message: 'noooooooo'
    callback: function () {} // called when finished

The failedMessage and pagePredicate properties are optional. If not supplied, mocha is assumed as the page testing framework.

For mocha tests it can be used like this:

var browsertest = require('../browsertest.js').browsertest,
    should = require('should'),
    assert = require('assert');

describe('browser tests', function () {

    it('should properly report the result of a mocha test page', function (done) {
            url: "file:///home/liam/work/browser-js-testing/tests.html",
            callback: function() { 


For other browser test tools define a 'pagePredicate' property on the options hash that returns { result: , message: }

Running the Tests

To run the included tests make sure you are in the root of the project, and run:

mocha -t 5000

where 5000 is the test timeout in milliseconds.