language: node_js
node_js:
  - "11"
services: mongodb
cache:
  directories:
  - node_modules
before_script:
  - sleep 15
  - mongo mydb_test --eval 'db.createUser({user:"travis",pwd:"test",roles:["readWrite"]});'
install:
  - npm install -g codecov
  - npm install -g istanbul@^1.0.0-alpha.2
  
jobs:
  include:
    - stage: "Install"
      script: npm install
    - stage: "Testing"
      script: npm run test
    - stage: "Coverage"
      script:
        - istanbul cover ./node_modules/mocha/bin/_mocha --reporter test -- -R spec
        - codecov