Skip to content

Instantly share code, notes, and snippets.

@milafrerichs
Last active February 1, 2019 09:56
Show Gist options
  • Save milafrerichs/7474cec7dcddac8fbf30eecfd040a088 to your computer and use it in GitHub Desktop.
Save milafrerichs/7474cec7dcddac8fbf30eecfd040a088 to your computer and use it in GitHub Desktop.
language: node_js
node_js:
- "10"
# Turns on newer container-based infrastructure
# This generates a sudo warning with mongodb below, see here: https://github.com/travis-ci/travis-ci/issues/3044
sudo: false
env:
global:
- NODE_ENV: test
- secure: entbiF59zjgSiel6S8bsKUrZVCXKsun9OqO95ABoQ8EaLrnP536EGVN/LurT/9W1QXcxLVChTpYZRizrhIoEQPi4vOVLrA5yhWlTGQULXWGNMf0VDTKfXOSQ6pV45zPnlmK/UV4eWAtDa7KsfOlPvQeX1K1JqSijLhPANNykGAQ=
- secure: YFYR9PLyfwpVVRoTeCz/0Cml2NDCrqUgufshdKxc5SM/l0Ix8XlP8eJ+s3CVArTzWJg9nzOopt9qaXtTbcN+Kr5SaMDpmjliXpmOGEkhx29dCTYuksjbGW44ImUWT2kaAARZnufPXrI7/QDxHjcaMWlR5wKveB/8m0FpEpd7YL4=
addons:
sauce_connect: true
services:
- mongodb
- redis-server
# We have `npm ci` errors, so force it to use `npm install`
install:
- npm install
before_script:
# Artificial wait before connecting to MongoDB
# https://docs.travis-ci.com/user/database-setup/#MongoDB-does-not-immediately-accept-connections
- sleep 15
# Start the server and run it in background process
- node index &
script:
# Note: don't run `npm test` here directly, it's intended for local testing.
- npm run jest --collectCoverage
- npm run lint
# Sauce-based tests cannot be performed on pull request open by user that
# doesn't have write permission to main repository
# https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
- 'if [ "$SAUCE_USERNAME" ] && [ "$SAUCE_ACCESS_KEY" ]; then protractor ./test/integration/saucelabs.conf.js; fi'
# Send exit signal to node process
after_script:
- bash <(curl -s https://codecov.io/bash)
- pkill node
after_failure:
- sudo service mongod status
cache:
directories:
- node_modules
- .cache
notifications:
slack:
secure: cqfsAO9mXGrdUl+f558aOlM1Z46UkvVU7dB5TvnXPUq7oim1NowQqCbSayCLtE2qayz+cVW1Qtid5znUygMOHgr3pWOJqnIN2Bjc6M2X+dLlnL6KAj+PS6uPHmlhwsArIdpDxkO1auVKODZAJbBuBhaFNhQphIzBbW4Cqc2Zn5w=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment