Use when tests need the app plus several real services (database, cache, queue) started together. Writes a compose.test.yaml with healthcheck-ordered startup, per-job project names for parallel CI, --wait and --exit-code-from gating, and clean teardown with volumes removed.
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Source docs: compose CLI reference, compose up, compose services schema.
depends_on conditions| Condition | Meaning |
|---|---|
service_started | Container has been created and started (default - usually wrong for tests). |
service_healthy | Dependency's healthcheck succeeded - the right choice for DBs / queues / app. |
service_completed_successfully | Dependency ran to completion and exited 0 - for one-shot init / migration containers. |
up flags (gate on readiness)| Flag | Effect |
|---|---|
--wait | "Wait for services to be running|healthy. Implies detached mode." |
--wait-timeout <seconds> | "Maximum duration in seconds to wait for the project to be running|healthy" |
--abort-on-container-exit | "Stops all containers if any container was stopped." (Foreground.) |
--abort-on-container-failure | "Stops all containers if any container exited with failure." |
--exit-code-from <service> | "Return the exit code of the selected service container. Implies --abort-on-container-exit." |
down flags (teardown)| Flag | Effect |
|---|---|
--volumes / -v | Remove named volumes declared in the compose file. Without this, DB state persists across runs and the next run sees stale data. |
--remove-orphans | Remove containers for services not defined in the current file. Defends against renamed services leaving stragglers. |