-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.test.yaml
More file actions
56 lines (53 loc) · 1.43 KB
/
docker-compose.test.yaml
File metadata and controls
56 lines (53 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: taskflow
POSTGRES_PASSWORD: taskflow
POSTGRES_DB: taskflow
volumes:
- postgres-test-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U taskflow"]
interval: 5s
timeout: 5s
retries: 5
app:
build:
context: .
dockerfile: Dockerfile.test
ports:
- "3001:3000" # Use 3001 to avoid conflicts with dev server
environment:
- NODE_ENV=development
- DATABASE_URL=postgresql://taskflow:taskflow@postgres:5432/taskflow
depends_on:
postgres:
condition: service_healthy
# Setup database and start the app in dev mode
command: sh -c "npx prisma db push && npm run dev"
tests:
build:
context: .
dockerfile: Dockerfile.test
environment:
- NODE_ENV=test
- DATABASE_URL=postgresql://taskflow:taskflow@postgres:5432/taskflow
- BASE_URL=http://app:3000
- NODE_OPTIONS=--require ./tests/e2e/console-log-proxy.js
depends_on:
app:
condition: service_started
# Wait for app, then run all tests sequentially
command: >
sh -c "
sleep 5 &&
echo '=== Running Unit Tests ===' &&
npm run test &&
echo '=== Running E2E Tests ===' &&
npm run db:reset &&
npx playwright test
"
volumes:
postgres-test-data: