services: test-backend: build: ./backend environment: - NODE_ENV=test - DB_HOST=test-mysql - DB_USER=test_user - DB_PASSWORD=test_password - DB_NAME=corps_directory_test_db depends_on: test-mysql: condition: service_healthy command: ["sh", "-c", "npm test"] test-mysql: image: mysql:8.0 environment: MYSQL_ROOT_PASSWORD: test_root_password MYSQL_DATABASE: corps_directory_test_db MYSQL_USER: test_user MYSQL_PASSWORD: test_password ports: - "3307:3306" # Map to a different port to avoid conflicts healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] interval: 10s timeout: 5s retries: 5