dist: trusty
sudo: false

language: node_js
node_js:
  - "7"
services:
  - postgresql

addons:
  postgresql: "9.6"

env:
  - DB_USER=test DB_PASSWORD=test DB_DATABASE=travis_ci_test DB_TEST_DATABASE=travis_ci_test DB_HOST=localhost DB_PORT=5432 TOKEN_SECRET=travis SERVER_PORT=3000

before_script:
  - psql -c 'CREATE DATABASE travis_ci_test' -U postgres
  - psql -c "CREATE USER test WITH PASSWORD 'test';" -U postgres

dist: trusty
sudo: required

language: node_js
node_js:
  - "7"
services:
  - postgresql
  - docker

addons:
  postgresql: "9.6"

env:
    - DB_USER=test DB_PASSWORD=test DB_DATABASE=travis_ci_test DB_TEST_DATABASE=travis_ci_test DB_HOST=localhost DB_PORT=5432 TOKEN_SECRET=travis SERVER_PORT=3000 DOCKER_COMPOSE_VERSION=1.16.1

before_install:
    - sudo rm /usr/local/bin/docker-compose
    - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
    - chmod +x docker-compose
    - sudo mv docker-compose /usr/local/bin

before_script:
    # Database for non-Docker execution
  - psql -c 'CREATE DATABASE travis_ci_test' -U postgres
  - psql -c "CREATE USER test WITH PASSWORD 'test';" -U postgres
    # Database for Docker execution
  - docker-compose run --rm web scripts/init.sh NONE

script:
    # Test non-Docker
  - npm run test
    # Test in Docker
  - docker-compose run --service-ports --rm web npm run test

Add Docker-based test to Travis definition file
Add Docker-based test to Travis definition file
