# Test against all versions of node with default phantomjs on Travis CI
language: node_js
sudo: required
node_js:
  - "9"
  - "8"
  - "6"
  - "4"
env:
  - PHANTOMJS_VERSION="TRAVIS"

# Additionally
matrix:
  # Ignore 0.11 test failures
  allow_failures:
    - node_js: "9"
  # Test against different phantomjs versions with node@0.10
  #   and test for spaces in filepath regression
  include:
    - node_js: "8"
      env: PHANTOMJS_VERSION="1.9.8"
    - node_js: "8"
      env: PHANTOMJS_VERSION="TRAVIS" TEST_SPACES=1

before_install:
  - curl --location http://rawgit.com/twolfson/fix-travis-ci/master/lib/install.sh | bash -s

install:
  # For space tests, move the directory to one with spaces
  - 'if test -n "$TEST_SPACES"; then cd .. && mv phantomjssmith "space phantomjssmith" && cd "space phantomjssmith"; fi'

  # Set up our version of PhantomJS
  - ./test/install.sh

  # Output phantomjs version
  - phantomjs --version

  # Install dependencies
  - npm install

notifications:
  email:
    recipients:
      - todd@twolfson.com
    on_success: change
    on_failure: change
