Once you have created your tests, you’ll need to create a
.travis.yml file in your repository. This file contains configuration information that tells Travis CI how to construct your testing environment and run your tests. For example, to run tests using Sauce Labs, a hosted web app testing service, your
.travis.yml file should look like the following:
language: node_js node_js: - "0.10" env: global: - SAUCE_USERNAME: username - SAUCE_ACCESS_KEY: access-key install: - npm install - cd node_modules/intern - npm install --production - cd ../.. script: node node_modules/intern/runner.js config=tests/intern
You will need to link your GitHub project to your Travis CI account for Travis CI to detect commits to your repository. The process for doing this is described in the Intern wiki. Once linked to your project, Travis CI will be notified of commits and will automatically run the tests specified in the
.travis.yml file in the source code branch that was committed.
Intern is easy to use with Travis CI, but can also be extended to work with other CI tools like Jenkins and TeamCity. In many cases this just means writing compatible reporters to allow Intern to produce output, like unit test and coverage reports, that the CI system can understand. Reporters can be very simple, and the Intern wiki has more information on writing and using them. Intern 1.4 includes an official TeamCity reporter, as well as
lcovhtml reporters, which are helpful for Jenkins users.