diff --git a/README.md b/README.md index 7deacdd5b1..8f1709eca6 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,10 @@ http://localhost:4242/features // Execute tests: npm test + + +// Run tests with postgres running in docker: +npm run docker-test ``` ### Making a schema change diff --git a/package.json b/package.json index aa773127f8..25a84762a5 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "build": "./node_modules/.bin/webpack", "dev": "NODE_ENV=development supervisor --ignore ./node_modules/,./public/js server.js", "test": "export PORT=4243 ; jest && jshint server.js lib test && jsxhint public/js/**/*.jsx && mocha test test/*.js && npm run coverage", + "docker-test": "export PORT=4243 ; ./scripts/docker-postgres.sh", "tdd": "mocha --watch test test/*", "test-bamboo-ci": "mocha test test/*", "coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec", diff --git a/scripts/docker-postgres.sh b/scripts/docker-postgres.sh new file mode 100755 index 0000000000..93e4a38c1e --- /dev/null +++ b/scripts/docker-postgres.sh @@ -0,0 +1,11 @@ +#!/bin/bash +export POSTGRES_PASSWORD="uleash" +export DATABASE_URL=postgres://postgres:unleash@127.0.0.1:15432/postgres + +HASH=`docker run -p 127.0.0.1:15432:5432 --name unleash-postgres -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD -d postgres:9.3` +npm install +./node_modules/.bin/db-migrate up +npm test +docker stop $HASH +docker rm $HASH +