Skip to content

Commit

Permalink
Merge pull request #22 from jniles/feature-travis-integration-tests
Browse files Browse the repository at this point in the history
FEAT(travis): make TravisCI run API tests
  • Loading branch information
sfount committed Jan 20, 2016
2 parents 00d9c50 + 4ee8a35 commit 6189c93
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ node_js:
before_script:
- npm install -g gulp bower mocha
- bower install
- mysql -u root -e "CREATE DATABASE bhima;"
- mysql -u root -e "CREATE USER 'bhima'@'localhost' IDENTIFIED BY 'HISCongo2013';"
- mysql -u root -e "CREATE DATABASE bhima_test;"
- mysql -u root -e "CREATE USER 'bhima_test'@'%' IDENTIFIED BY 'HISCongo2013';"
- mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'bhima'@'localhost' WITH GRANT OPTION;"
- mysql -u root bhima < server/models/schema.sql

cache:
directories:
Expand All @@ -29,3 +28,6 @@ git:
# make sure we aren't caching verbose output from NPM
before_cache:
- rm -f npm-debug.log

services:
- mysql
34 changes: 31 additions & 3 deletions sh/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,42 @@
# This file runs some lint checks using Travis CI

# lint the client
echo "Linting the client ..."
echo "[LOG] Linting the client ..."
gulp lint

# build the application
echo "Building the application ..."
echo "[LOG] Building the application ..."
gulp build

# lint the server
echo "Linting the server ..."
echo "[LOG] Linting the server ..."
jshint server/{controllers,lib,config}/*.js
jshint server/controllers/{categorised,medical,reports,stock,finance}/*.js

# Instructions for Travis to build the MySQL database
# NOTE - the bhima user is already defined in the .travis.yml

echo "[LOG] Building the database ..."

user="bhima"
pw="HISCongo2013"

# build the test database
mysql -u $user -p$pw -e "DROP DATABASE IF EXISTS bhima_test;"
mysql -u $user -p$pw -e "CREATE DATABASE bhima_test CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
mysql -u $user -p$pw bhima_test < server/models/schema.sql
mysql -u $user -p$pw bhima_test < server/models/test/data.sql
mysql -u $user -p$pw bhima_test < server/models/updates/synt.sql

echo "[LOG] Building and running server in development mode ..."

# build and start the server
npm run dev &

# make sure we have enough time for the server to start
sleep 10

echo "[LOG] Running integration tests."

# run the tests
mocha server/test/api/

0 comments on commit 6189c93

Please sign in to comment.