Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: running integration tests on a separate database #83

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
REDIS_URL=redis://redis:6379/1
RDS_HOSTNAME=postgres_test
RDS_PORT=5432
RDS_DB_NAME=app
RDS_USERNAME=postgres
RDS_PASSWORD=password
APP_NAME=express-boilerplate
AUTH_API_KEY=b6cfcd8f-db8e-2cb5-cb34-e1a8900067fd
STAGE=development
BITBUCKET_COMMIT=commit_sha
API_URL=http://localhost:1337
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ services:
networks:
- app

js_test:
image: app:local
env_file:
- .env.test
depends_on:
- postgres_test
- redis
networks:
- app

boilerplate_api:
<<: *common
working_dir: /app/build
Expand All @@ -62,6 +72,15 @@ services:
networks:
- app

postgres_test:
image: postgres:14-alpine
environment:
POSTGRES_PASSWORD: password
POSTGRES_USERNAME: postgres
POSTGRES_DB: app
networks:
- app

redis:
container_name: redis
image: 'redis'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"integration-tests": "cd build && node ../node_modules/.bin/mocha \"src/tests/**/*.spec.js\" --file=\"src/tests/bootstrap.js\" --exit",
"services-units": "cd build && node ../node_modules/.bin/mocha \"src/{,!(tests)/**}/*.spec.js\"",
"services-units-coverage": "nyc npm run services-units",
"integration": "docker-compose run --rm js npm run integration-tests",
"integration": "docker-compose run --rm js_test npm run integration-tests",
"units": "docker-compose run --rm js npm run services-units-coverage",
"shell": "docker-compose run --rm js sh",
"generate-migration": "docker-compose run --rm js ./node_modules/.bin/typeorm migration:generate ./src/migrations/migration -d ./build/src/config/db",
Expand Down
Loading