mocha

Running mocha tests on testling-ci is pretty simple.

configuring package.json

First you'll need to add a "harness" field with the relevant user-interface to use. The available interfaces are:

An interface harness of "mocha" is the same as "mocha-bdd" since bdd is mocha's default ui.

In your package.json "testling" field, add a "harness" entry like in this example:

{
  "name": "beep-boop",
  "version": "1.2.3",
  "main": "index.js",
  "devDependencies": {
    "mocha": "~1.0.2"
  },
  "testling": {
    "harness": "mocha-tdd",
    "files": "test/*.js",
    "browsers": [
      "ie/8..latest",
      "chrome/latest",
      "firefox/latest"
    ]
  },
  "scripts": {
    "test": "mocha --ui tdd"
  }
}

Make sure that "mocha" is listed under "devDependencies".

testing locally

It's a good idea to verify your configuration locally before running your tests on testling-ci.

First install the testling command if you haven't already done so:

npm install -g testling

Now from the project root directory, simply type testling:

$ testling

1..1
ok 1 integers should square the numbers
# tests 1
# pass 1
# fail 0

The testling command automatically reads your package.json and parses the "testling" field to figure out how to run your tests. It spins up a real local browser (chrome or firefox) and launches it headlessly.

You can specify a custom browser command to run with the --bcmd argument or you can run testling -u to simply print a url so you can visit the page manually.

add a webhook for testling-ci

Now put your repository on github and add a github webhook from the settings/hooks page:

https://github.com/$USERNAME/$REPO/settings/hooks

Under "AVAILABLE SERVICE HOOKS", click "WebHook URLs". Now add http://git.testling.com as a WebHook URL.

Now every time you push new code to github, your tests will be run on testling-ci. You can also click the "test hook" button on github to send a hook without pushing new code.

quick start guide
Create a github hook to run your tests on every push. Get a browser badge.
writing tests with tape
Write tests with a minimal test api that works in both node and browsers.
testing locally
Run your tests in node and your local browsers.
writing tests with mocha
Run tests in mocha for qunit, tdd, bdd, and exports-style tests.
module-driven development
Write code that is easier to maintain and easier to test with browserify.
dependency management
Use npm to manage your front-end dependencies.
advanced configuration
Read in-depth about the package.json "testling" field.
custom test libraries
Use your own test library by outputting TAP with `console.log()`.