---
language: node_js

node_js:
  - node
  - "8"
  - "6"

cache:
  yarn: true
  directories:
    - node_modules

env:
  global:
    - NODE_ENV=development
  matrix:
    - JOB=test AST_COMPARE=1

matrix:
  fast_finish: true
  include:
    - node_js: "node"
      env: JOB=lint
  # Our test fail with a segfault in node 6
  # (see https://github.com/prettier/prettier/issues/3457)
  # To prevent making our Travis run useless, mark Node 6 as allowed to fail.
  allow_failures:
    - node_js: "6"

install:
  - yarn install

before_script:
  - yarn check-deps

script:
  - if [ "${JOB}" = "lint" ]; then yarn lint && yarn lint-docs; fi
  - if [ "${JOB}" = "test" ]; then yarn test --runInBand --ci; fi
  - if [ "${JOB}" = "test" ]; then yarn codecov; fi

branches:
  only:
    - master
