2023-07-27 19:48:40 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# src/run-integration.sh
|
|
|
|
|
2023-07-28 01:22:10 +03:00
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
2023-07-28 01:38:50 +03:00
|
|
|
source $DIR/set-env-test.sh
|
2023-07-28 01:22:10 +03:00
|
|
|
|
2023-07-27 19:48:40 +03:00
|
|
|
npx ts-node ./test/utils/check-db.ts
|
|
|
|
EXIT_CODE=$?
|
|
|
|
|
|
|
|
if [ $EXIT_CODE -ne 0 ]; then
|
|
|
|
echo '🟡 - Database is not initialized. Running migrations...'
|
2023-09-21 05:11:21 +03:00
|
|
|
npx ts-node ./test/utils/setup-db.ts
|
2023-07-27 19:48:40 +03:00
|
|
|
npx prisma migrate reset --force && yarn prisma:generate
|
2023-09-21 05:11:21 +03:00
|
|
|
yarn typeorm:migrate
|
2023-07-27 19:48:40 +03:00
|
|
|
else
|
|
|
|
echo "🟢 - Database is already initialized."
|
|
|
|
fi
|
|
|
|
|
|
|
|
yarn jest --config ./test/jest-e2e.json
|