Intern Logo

We’ve recently made a number of updates to Intern, providing additional flexibility and integration for writing and running tests. Seth Holladay and sitecues by Ai Squared generously sponsored some of these efforts!

Continuous integration

Intern has long supported continuous integration, officially supporting travis-ci, Jenkins, and TeamCity. Intern provides a very flexible reporter system, making it easy to add new output formats. We have received requests recently to support Bamboo and Codeship.

Codeship

Codeship provides an impressive set of continuous integration features. Codeship Logo Integration with Intern is surprisingly straightforward. You configure your repository and provide a set of commands to run. Every commit made to your repository runs those commands. This is exactly like running Intern on your local development machine, except that it happens automatically on each commit. Emails are sent automatically for any build failures, providing detailed information about how the build failed, including links to more information and logs.

Bamboo

Bamboo logo
Bamboo is a continuous integration platform provided by Atlassian (known best for their Jira and BitBucket products). Intern already includes JUnit support with its provided test reporter. The JUnit format is a defacto standard that has slight variations between tools that rely on it such as Jenkins. We investigated the process for setting up Intern with Bamboo, and documented and verified a workflow for automatically running your tests with Bamboo.

Test suite improvements

As more people have started to use Intern, we have received a number of feature requests to refine Intern’s approach to testing.

Skip suite

Intern has long had the capability to skip a test, but not a streamlined syntax for skipping an entire test suite. The new release adds a skip method to Suite that can be called from a test or suite lifecycle method to skip an entire suite.

registerSuite({
    name: 'some suite',

    before: function () {
        if (!firstCondition) {
            // Skip the entire suite
            this.skip('first condition not met');
        }
    },

    // tests

    'a test': function () {
        if (!secondCondition) {
            // Skip this test and the remainder of the suite
            this.parent.skip('second condition not met');
        }

        // test code
    },

    // more tests
});

Auto-glob

When Intern is running in Node.js, it has filesystem access and can now process glob patterns in suites and functionalSuites. This can be used as an alternative to using a test grouping module, and may also be useful during test development to easily select subsets of tests to run.

intern-client config=tests/intern 'suites=tests/unit/f*'
define({
    // ...

    suites: [
        'tests/unit/f*',
        'tests/unit/{bar,baz}/*',
        'tests/unit/qux/**/*'
    ]
});

Fast fail

When running regression tests, it is often beneficial to accelerate the test, fix, test, fix workflow by ending the testing process at the first sign of a failed test. This allows you to know more quickly if your change introduces a regression, so you can then fix it, rather than waiting for all other tests to finish running. This is particularly important in a very large project where a test suite may take many minutes to complete.

Intern now has a “bail” configuration option. When a test fails and this option’s value is true, all remaining tests in all remaining suites, both unit and functional, are skipped.

Async suites

Intern was built with async and promises in mind, and suite lifecycle methods have supported async operations for some time now, but without some of the convenience features available in tests. With the latest release, Intern now provides an async method in suite lifecycle methods that operates similarly to the async method in tests. Calling this.async() in a suite lifecycle method will return a Deferred object, and the lifecycle method will wait for that Deferred (or a returned Promise) to resolve.
Gulp Logo

Gulp integration

Intern provides a default Grunt task, but has never included a similar plugin for gulp, primarily because such a plugin would be counter to the philosophy of gulp. However, using Intern with gulp is not difficult, and the Intern guide now includes a workflow for using gulp to run your Intern tests.

Intern community updates

Our remap-istanbul project, which makes it easy to get code coverage analysis with transpiled code such as ES6 or TypeScript, has received a number of small updates. It is now being used in a wide variety of projects that leverage Istanbul for code coverage analysis. We also added inline source maps to help when your build tool includes source maps within the compile JavaScript file rather than as a separate file.

Dojo Logo
In our development efforts for Dojo 2, we have setup integration with codecov.io. In order to make this possible, we have created a pull request to add support for code coverage information in JSON format.

Getting involved

We’re always looking for help to improve Intern. If you would like to contribute, please start by looking at the open issues and the contribution guidelines.

Or if you are too busy to help, but have features or bug fixes you would like prioritized, please contact us to discuss opportunities to sponsor Intern development efforts.

As noted earlier, we greatly appreciate Seth Holladay and sitecues by Ai Squared sponsoring some of these efforts!

Learning more

If you’re just getting started with Intern, or want to learn more about automated testing your JavaScript applications, you should attend one of our workshops or let us know if you’d like to schedule a workshop for your team.

Beyond workshops, we also help teams optimize their approach to automated testing via our JavaScript support and web application development and consulting services. We help many organizations refine their approach to testing, and we’re happy to provide an initial consultation.