We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Guide on Testing Child Processes with Mocked Dependencies in Elixir
152
clicks

Source: mirego.com
The article addresses common problems faced when testing child processes with mocked dependencies in Elixir. Benoit Ducharme explains that issues such as the `UndefinedFunctionError` and `Mox.UnexpectedCallError` occur because the process starts before the mock is defined or because the expectations are process-based and the child process does not access the mock. The piece offers a solution: injecting the process only in non-test environments and configuring tests to allow access to the mock using Mox in global mode. Specific code snippets and configuration changes are provided to illustrate the solution.
Related posts
© HashMerge 2025