rebar3 3.14 upgrade and test directories

This is the situation:

  • you have an Erlang/OTP project
  • you have tests in test directory (cool!)
  • you have one or more sub-directories in your test directory containing source files
  • you just got upgraded to rebar3 version 3.14 and your tests started to fail

You might get an undef error because modules in test sub-directories are no longer compiled.

Here’s the solution – add the following to your test profile in rebar.config:

{extra_src_dirs, [{"test", [{recursive, true}]}]}

Why? rebar3 version 3.14 no longer automatically finds and compiles source files in test sub-directories. The above configuration forces it to do so.