Running tests in docker container
Hi! I am trying to run my tests in a docker container, however I am getting these errors because it can't find the formatter.ex and json_encoder.ex in my container:
-r : No files matched pattern /Users/steve/.local/share/nvim/lazy/neotest-elixir/neotest_elixir/json_encoder.ex
-r : No files matched pattern /Users/steve/.local/share/nvim/lazy/neotest-elixir/neotest_elixir/formatter.ex
Is there a way to override these paths somehow so I can mount the files and point to the new location in the container?
Here is how I am setting it up:
require("neotest").setup({
log_level = vim.log.levels.DEBUG,
adapters = {
require("neotest-elixir")({
post_process_command = function(cmd)
return vim.tbl_flatten({
{ "docker", "compose", "exec", "-i" },
{ "-w", "/app" },
{ "-e", "MIX_ENV=test" },
{ "app" },
cmd })
end,
}),
},
})
Or do you have a better recommendation for how to run these in docker instead?
Running inside Docker is tricky. See https://github.com/nvim-neotest/neotest/issues/89. Most of the issues mentioned there apply to the Elixir adapter as well.
You could overwrite the paths in post_process_command. If everything works, we can add an option to specify the base path when configuring the adapter. Besides that, the formatter receives an env var with the path where it's going to write the output files. When running inside a container, those files would be in the container, so they would need to be mounted as well so that the Neovim side can read them.