Intern 2.1 is now available with new HTML and JUnit reporters, grep and skip functions, improved performance, and more!

Testing your apps is about to get a whole lot easier.

  • Run tests straight from your browser or Node.js.
  • Write tests using any style you like (TDD, BDD, whatever!).
  • Get full code coverage reporting so you know what’s left to test.
  • Seamlessly run tests on Sauce Labs, BrowserStack, TestingBot, or your own Selenium Grid.
  • Ready for continuous integration? Intern works with Travis CI, Jenkins, and TeamCity out of the box.

Get it on GitHub or keep reading to learn more

Features

Seamless cloud support

Intern integrates with popular cloud-hosted testing providers like Sauce Labs, BrowserStack, and TestingBot, with job status reporting, through our new Dig Dug tunnel library.

Functional testing

Mimic real user interactions from outside the browser sandbox—and even test non-JavaScript Web and mobile apps—with Leadfoot, our advanced WebDriver client.

Continuous integration

Continuous integration is a critical part of software development, so Intern integrates with Travis CI, Jenkins, or TeamCity in seconds and can be extended to support any other CI system.

Modular by nature

Intern itself is written using the AMD module format which means testing AMD-based applications is a breeze.
(It works great for testing non-AMD code, too!)

Promise-based async

A test loop built with Promises makes asynchronous tests trivial to write and easy to read, with no wasteful polling and no nasty callback chains.

Code coverage

If you don’t know what code runs when your tests do, how do you know what’s actually being tested? Intern uses Istanbul to provide complete code coverage reporting for your app.

Source map support

Easily test compiled or minified code and get stack traces with pointers back to the original source on test failure.

Grunt support

Grunt is so popular we just went ahead and baked a task right into Intern, so you can use it straight-up without any other dependencies.

Genuine open-source

Intern is New BSD licensed, and all code contributions are covered by a 100-point Dojo Foundation CLA.

Write simple tests and see output quickly

Write one of these:
BDD
TDD
Object
define([
  'intern!bdd',
  'intern/chai!expect',
  '../MyWidget'
], function (bdd, expect, MyWidget) {
  bdd.describe('demo widget', function () {
    var widget;

    bdd.before(function () {
      widget = new MyWidget();
    });

    bdd.after(function () {
      widget.destroy();
    });

    bdd.it('should have children', function () {
      expect(widget.children).to.not.be.empty;
    });
  });
});
define([
  'intern!tdd',
  'intern/chai!assert',
  '../MyWidget'
], function (tdd, assert, MyWidget) {
  tdd.suite('demo widget', function () {
    var widget;

    tdd.before(function () {
      widget = new MyWidget();
    });

    tdd.after(function () {
      widget.destroy();
    });

    tdd.test('creation', function () {
      assert(widget.children.length > 0,
        'Widget should have children');
    });
  });
});
define([
  'intern!object',
  'intern/chai!assert',
  '../MyWidget'
], function (registerSuite, assert, MyWidget) {
  var widget;

  registerSuite({
    name: 'demo widget',

    setup: function () {
      widget = new MyWidget();
    },

    teardown: function () {
      widget.destroy();
    },

    creation: function () {
      assert(widget.children.length > 0,
        'Widget should have children');
    }
  });
});
Run this:
$ intern-runner config=tests/intern
Get this:
Opening local tunnel using Sauce Connect
Listening on 0.0.0.0:9000
Starting tunnel...
Ready
Initialised internet explorer 11 on WINDOWS
Initialised chrome 34.0.1847.116 on Mac OS X
Initialised firefox 28.0 on LINUX
...
chrome 34.0.1847.116 on Mac OS X: 0/70 tests failed
...
-------------+---------+-----------+---------+---------+
File         | % Stmts |% Branches | % Funcs | % Lines |
-------------+---------+-----------+---------+---------+
 MyWidget.js |   87.15 |     66.47 |   79.55 |   87.15 |
-------------+---------+-----------+---------+---------+
All files    |   87.15 |     66.47 |   79.55 |   87.15 |
-------------+---------+-----------+---------+---------+

TOTAL: tested 3 platforms, 0/210 tests failed

Run tests in any environment

Browser client

Run unit tests straight from any browser
no Node.js server needed!—by navigating
to the included standalone HTML page.

Node.js client

Writing server-side or command-line code?
A standalone Node.js client is also included,
so you can test those too.

WebDriver client

Intern’s test runner executes tests in multiple environments at the same time. It can even test non-JavaScript server-side and mobile apps.

How Intern compares

Feature Intern QUnit Mocha Jasmine BusterJS Karma Nightwatch.js
Includes unit testing Yes Yes Yes Yes Yes No No
Includes functional testing Yes No No No No No Yes
Code coverage analysis Yes No Yes No Extension Yes No
True1 browser events Yes No No No No No Yes
Native AMD support Yes No No No Extension Extension No
Stand-alone2 browser support Yes Yes Build required Build required Experimental No No
Node.js support Yes No3 Yes Yes Yes Yes No
Source map support Yes No No No No No No
Any4 assertion library Yes No Yes No Yes N/A No
Default test interface TDD, BDD, object TDD TDD, BDD, object BDD TDD, BDD N/A Object
Extensible test interfaces Yes No Yes No Yes N/A Commands only
Extensible reporters Yes No Yes No Yes N/A No
Asynchronous support Promises Globals Callbacks, Promises Polling Callbacks, Promises Callbacks Callbacks
Selenium support Yes No No No No No Incomplete
Fixes Selenium bugs Yes No No No No No No
Tests native mobile apps Yes No No No No No Yes
Built-in CI support Yes No No No Yes Yes Partial
Built-in Sauce Labs integration Yes No No No No No No
Built-in BrowserStack integration Yes No No No No No No
Built-in TestingBot integration Yes No No No No No No
Built-in Travis CI integration Yes No No No No Yes No
Grunt support Yes 3rd party

1: True events are not generated by JavaScript within the sandbox, so are able to accurately emulate how a user actually interacts with the application. Synthetic events generated by other test frameworks are limited by browser security restrictions.

2: Stand-alone means that unit tests can be executed in a browser by navigating to a URL without needing any special HTTP server or proxy for support.

3: Some older versions of QUnit can be used in conjunction with a 3rd party module to run on Node.js, but newer versions do not support Node.js and will break even with the use of 3rd party modules.

4: If it throws an error on failure, it works with Intern.

Start testing your code today

Get it on GitHub New BSD License

How to contribute

Intern is an open-source project hosted on GitHub, so contributing is easy! Just fork us on GitHub, write your patch in a new branch, then submit a pull request. If you’ve never contributed to a Dojo Foundation project before, you will also need to take a moment to fill out the Dojo Foundation CLA. Please be sure to follow our coding conventions.

Need some help?

Don’t stress if you get stuck and need a little assistance. Free, community-provided Intern support is always available. SitePen also offers commercial support for Intern if you need a little extra TLC.