mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
Run tests with database in docker #64
This commit is contained in:
parent
c67b73b5b3
commit
9e949537f6
@ -49,6 +49,10 @@ http://localhost:4242/features
|
|||||||
|
|
||||||
// Execute tests:
|
// Execute tests:
|
||||||
npm test
|
npm test
|
||||||
|
|
||||||
|
|
||||||
|
// Run tests with postgres running in docker:
|
||||||
|
npm run docker-test
|
||||||
```
|
```
|
||||||
|
|
||||||
### Making a schema change
|
### Making a schema change
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"build": "./node_modules/.bin/webpack",
|
"build": "./node_modules/.bin/webpack",
|
||||||
"dev": "NODE_ENV=development supervisor --ignore ./node_modules/,./public/js server.js",
|
"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",
|
"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/*",
|
"tdd": "mocha --watch test test/*",
|
||||||
"test-bamboo-ci": "mocha test test/*",
|
"test-bamboo-ci": "mocha test test/*",
|
||||||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec",
|
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec",
|
||||||
|
11
scripts/docker-postgres.sh
Executable file
11
scripts/docker-postgres.sh
Executable file
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user