sudo: required
dist: trusty
language: node_js
addons:
  firefox: 'latest'
  apt:
    sources:
      - google-chrome
    packages:
      - google-chrome-stable

node_js:
  - '4.6'

install:
  - npm install
  # Firefox.
  - ./node_modules/.bin/mozilla-download ./firefox/ --product firefox --branch mozilla-aurora
  - export FIREFOX_NIGHTLY_BIN="./firefox/firefox/firefox-bin"
  # Chrome.
  - export CHROME_BIN=/usr/bin/google-chrome

before_script:
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start

script:
  - $CI_ACTION

env:
  global:
    - TEST_SUITE=unit
  matrix:
    - CI_ACTION="jest"
    - CI_ACTION="npm run test:chrome -- --single-run"
    - CI_ACTION="npm run test:firefox -- --single-run"

branches:
  only:
    - master

cache:
  directories:
    - node_modules
