Search code examples
elixirelixir-mix

Mix Test - Test patterns did not match any file


I wrote a few tests for my Elixir project and put them in the test/ directory. Now that I run mix test, I get:

$ mix test
Test patterns did not match any file: 

That's it, there's nothing after that. Do I have to manually set the path for my tests? A quick Google search did not reveal anything.


This is what all of my tests look like:

# project_dir/test/my_app/some_module.exs

defmodule MyApp.SomeModule.Test do
  use ExUnit.Case
  doctest MyApp.SomeModule

  test "method 1" do
    assert MyApp.SomeModule.method_1_works?
  end

  test "method 2" do
    assert MyApp.SomeModule.method_2_works?
  end
end 

Solution

  • All tests are supposed to end with _test.exs. Renaming my tests from some_module.exs to some_module_test.exs fixed it, and now it works.

    From $ mix help test:

    This task starts the current application, loads up test/test_helper.exs and then requires all files matching the test/**/_test.exs pattern in parallel.


    I'd still like to know if it's possible to manually configure test paths (even if the word 'test' doesn't come at the end).