Running tests with Testem

If you’ve gone through the Getting started and Loading your code tutorials, this article will show you how to run your tests using Testem.

If you have an existing web page that runs your jstest suite, then running it with Testem is straight-forward. First, install testem from npm:

$ npm install testem

Add this config file at example/testem.json:

// example/testem.json

{"test_page": "example/browser.html#testem"}

That #testem hash makes jstest load Testem and automatically use the right reporter for it.

Run this command to launch the server:

$ ./node_modules/.bin/testem -f example/testem.json

You should see something like this in your terminal:

Open http://localhost:7357/ in your browser, and you should see your tests running:

Your terminal will summarise the results for all the browsers you have opened and trigger a new test run every time you change your source code.