Is it possible to suppress process-specific error messages during testing?

I’m trying to do something unusual with testing and have to use assert_receive to assert an :EXIT. This works, but I still get a “[error] GenServer #PID<0.x.0> terminating” message in the log. Is it possible to suppress error logging for a specific process?

1 Like

You can use this: ExUnit.CaptureLog — ExUnit v1.13.4


In addition to what @LostKobrakai suggested, if you want to disable error logging for all your tests, you can use the capture_log: true option when starting ExUnit in your test_helper.exs:

ExUnit.start(capture_log: true)

As the docs say, you can also disable/enable this behavior for single tests using tags: ExUnit — ExUnit v1.13.4