From 95e2961d1bd4b0d64b126e08f99b69e6c1e800ba Mon Sep 17 00:00:00 2001 From: Gard Rimestad Date: Mon, 15 Dec 2014 07:53:10 +0100 Subject: [PATCH 1/2] Create test database with pg_virtualenv and run tests against it with npm run pg-virtualenv-test --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 25a84762a5..65c1e1d483 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,9 @@ "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", + "pg-virtualenv-test": "pg_virtualenv npm run pg-virtualenv-chain", + "pg-virtualenv-chain": "export TEST_DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@localhost:$PGPORT/postgres ; npm run db-migrate-testdb ; npm test", + "db-migrate-testdb": "DATABASE_URL=$TEST_DATABASE_URL ./node_modules/.bin/db-migrate up", "tdd": "mocha --watch test test/*", "test-bamboo-ci": "mocha test test/*", "coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec", From ec4734d0f8e0b131b4b32a0c22496b45af48f2f1 Mon Sep 17 00:00:00 2001 From: Gard Rimestad Date: Mon, 15 Dec 2014 09:41:13 +0100 Subject: [PATCH 2/2] Use pg_virtualenv in finnubuild --- finnbuild.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finnbuild.json b/finnbuild.json index 3af45d1743..d336282d89 100644 --- a/finnbuild.json +++ b/finnbuild.json @@ -10,7 +10,7 @@ }, "tasks": { "deploy": [ - {"command": "npm install && npm test && npm run build"}, + {"command": "npm install && npm run pg-virtualenv-test && npm run build"}, {"command": "tar -cvzf unleash-server.tar.gz --exclude=unleash-server.tar.gz --exclude=.git *"}, { "command": "mvn deploy:deploy-file -Durl=http://mavenproxy.finntech.no/finntech-internal-snapshot/ -DrepositoryId=finntech-internal-snapshot -Dfile=unleash-server.tar.gz -DgroupId=no.finntech.unleash -DartifactId=unleash-server -Dversion=0.1337-SNAPSHOT -Dpackaging=tar.gz", @@ -36,7 +36,7 @@ ], "default": [ - {"command": "npm install && npm test"}, + {"command": "npm install && npm run pg-virtualenv-test"}, ] }