ExUnit.CaptureIO could only capture output by
IO.inspect but if the output is by NIF the
capture_io returns an empty string.
Not really because IO operations in NIFs do not necessarily go through the runtime system.
You could change the NIFs to either:
Send a message to the relevant IO process (aka the group leader) from the NIF (you can pass the group_leader when calling the NIF and message it)
You send them as messages to another process which will either log or call the relevant IO module
This makes the system asynchronous though, which may on the other hand complicate the testing of the captured contents.