Skip to content

Travis CI integration

Jason Cheatham edited this page Jun 25, 2014 · 6 revisions

Intern is designed to easily integrate with the Travis CI continuous integration service. In order to enable Travis CI for your project, you must first create a .travis.yml in your repository root that will load and execute Intern. For a typical project using BrowserStack, it should look like this:

language: node_js
node_js:
  - '0.10'
env:
  global:
    - BROWSERSTACK_USERNAME: username
    - BROWSERSTACK_ACCESS_KEY: access-key
script: node_modules/.bin/intern-runner config=tests/intern

If you are not OK exposing your BrowserStack username and access key, you may use secure environment variables to encrypt them (travis encrypt "BROWSERSTACK_USERNAME=username BROWSERSTACK_ACCESS_KEY=access-key"). However, this will mean that pull requests are no longer tested.

Once you have a Travis configuration, you just need to actually start the thing:

  1. Go to https://travis-ci.org/
  2. Click “Sign in with GitHub” at the top-right
  3. Allow Travis CI to access your GitHub account
  4. Go to https://travis-ci.org/profile
  5. Click “Sync now”, if necessary, to list all your GitHub projects
  6. Click the “Profile” tab
  7. Copy the “Token” value to your clipboard
  8. Click the “Repositories” tab
  9. Click the on/off switch next to the repository you want to test
  10. Click the wrench icon next to the repository you want to test
  11. Find Travis in the list of services and click it
  12. Paste the token from your clipboard to the Token field
  13. Click “Save changes”
  14. Click “Test Hook”

If the test hook was successful (it may take several minutes for the test hook to trigger a build), you will be able to watch Intern happily execute all your tests directly from the Travis CI Web site. Any time you make a new commit, or a new pull request is issued, Travis will automatically re-run your test suite. Simple!

Clone this wiki locally