language: node_js
node_js:
  - "8.9"
  - "9.3"
sudo: false
cache:
  directories:
    - node_modules
before_install:
  # Skip updating shrinkwrap / lock
  - "npm config set shrinkwrap false"
  # Setup Node.js version-specific dependencies
  - "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
  - "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 4 || npm rm --save-dev eslint eslint-plugin-markdown"
  # Update Node.js modules
  - "test ! -d node_modules || npm prune"
  - "test ! -d node_modules || npm rebuild"
script:
  # Run test script, depending on istanbul install
  - "test ! -z $(npm -ps ls istanbul) || npm test"
  - "test   -z $(npm -ps ls istanbul) || npm run-script test-travis"
  - "test   -z $(npm -ps ls eslint) || npm run-script lint"
after_script:
  - "test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"

