Hi Nathan!

The issue is that the compiler is just one of many ways where we can define
modules in Elixir. Maybe you expected this module to be define in your
test_helper and you have a type in the module name. The module could also
have come from a dependency and you had a typo in its name when using it.

I think ultimately pointing towards elixirc_paths would be misleading.



*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*

On Wed, May 9, 2018 at 11:25 PM, Nathan Long <[email protected]> wrote:

> I just added a `test/support` directory and `test/support/data_case.ex` to
> my Mix application. When I tried to `use MyApp.DataCase`, I got a
> `CompileError` like `module MyApp.DataCase is not loaded and could not be
> found`.
>
> This confused me for a moment, because I clearly had the right name. After
> a few minutes, I realized the problem: `test/support` was not part of my
> `elixirc_paths` in `Mix.exs`. I needed:
>
> def project do
> [
> ...
>       elixirc_paths: elixirc_paths(Mix.env()),
> ...
> ]
> end
>
> and
>
>   defp elixirc_paths(:test), do: ["lib", "test/support"]
>   defp elixirc_paths(_), do: ["lib"]
>
> I don't know if it's a common cause, but perhaps this error could be made
> friendlier with a hint like "current `elixirc_paths` are..."?
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/4dcf2571-976e-4fb4-8fd4-
> 58b8cc0508b1%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/4dcf2571-976e-4fb4-8fd4-58b8cc0508b1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Lg7NmSy8Sv2DnhUmbWkpcq0F2qpaCiP85KkWov28nrYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to