You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to use `mix testcontainers.run phx.server`or other development tasks with a containerized database, you can configure your`config/dev.exs`similarly:
139
+
Instead of editing dev.exs or test.exs, you can let testcontainers set `DATABASE_URL` and use it from`config/runtime.exs`for dev and test:
This allows you to run your Phoenix server with a containerized database:
155
+
This allows you to run your Phoenix server or tests with a containerized database without changing dev.exs or test.exs (remember to set MIX_ENV when running tests):
Activate reuse of database containers started by mix task with adding `testcontainers.reuse.enable=true` in `~/.testcontainers.properties`. This is experimental.
182
169
183
-
You can pass arguments to the sub-task by appending them after the sub-task name. For example, to pass arguments to mix test:
170
+
You can pass arguments to the sub-task by appending them after `--`. For example, to pass arguments to mix test:
184
171
185
-
`mix testcontainers.run test --exclude flaky --stale`
172
+
`MIX_ENV=test mix testcontainers.run test -- --exclude flaky --stale`
186
173
187
174
In the example above we are running tests while excluding flaky tests and using the --stale option.
188
175
176
+
Note: MIX_ENV is not overridden by the run task. For tests, set it explicitly in the shell:
177
+
178
+
`MIX_ENV=test mix testcontainers.run test`
179
+
189
180
#### Backward Compatibility
190
181
191
182
For backward compatibility, the old `mix testcontainers.test` task is still available and works exactly as before. It automatically delegates to `mix testcontainers.run test`, so existing scripts and workflows will continue to work without modification:
0 commit comments