I would like to put test files alongside the actual code/file that will be tested.
Is it possible? If yes, how can I setup this?
Example:
lib/kv.ex
lib/kv_test.exs
I would like to put test files alongside the actual code/file that will be tested.
Is it possible? If yes, how can I setup this?
Example:
lib/kv.ex
lib/kv_test.exs
Take a look at https://hexdocs.pm/mix/Mix.Tasks.Test.html#module-configuration
Especially the option test_path.
@NobbZ many thanks!
Just to keep it extremally clear for someone facing the same challenge in the future, what you need to do is:
1) Go to the file mix.exs
and add test_paths: ["lib"]
in the project
function.
Example:
def project do
[
app: :kv,
version: "0.1.0",
elixir: "~> 1.5",
start_permanent: Mix.env == :prod,
test_paths: ["lib"],
deps: deps()
]
end
2) Put the test_helper.exs
file inside the lib
folder
3) Now you can create all your test files inside the lib
folder