jfpedroza / neotest-elixir

Neotest adapter for Elixir
MIT License
38 stars 10 forks source link

Support for running tests in the IEx shell #23

Closed scottming closed 10 months ago

scottming commented 1 year ago

Fixes #12 Closes #14

Hi, @jfpedroza , It's super fast and works very well(single test, test file, test folder, whole project, and so on). You can test it with

neotest.setup_project(vim.loop.cwd(), {
    adapters = { require("neotest-elixir") },
    default_strategy = "iex",
})

The core idea is:

  1. Check if there is an IEx shell terminal; if not, then create one and run the start command
  2. Send the IExUnit.run and ExUnit.configure(output: output, seed: seed) to the IEx shell
  3. use tail -f | grep to watch the results.

The caller code is here: https://github.com/jfpedroza/neotest-elixir/blob/dc6eb4502916a69ac67554516facf38f0f04d919/lua/neotest-elixir/init.lua#L191-L197

I also refactored the build_spec code and added tests because that part of the code was a bit confusing when stacked together.

Preview

With neotest command

https://user-images.githubusercontent.com/12830256/222431631-243135d3-2389-446e-8f49-80416f35af43.mp4

With test tree

https://user-images.githubusercontent.com/12830256/222431378-eee1372e-8629-4d18-9a3e-961c1b87362c.mp4

Knowing issues:

link: #12

scottming commented 10 months ago

Since I didn't get a clear response from you @jfpedroza , I'm going to close this PR. Then I'll continue development in the forked repository.

scottming commented 10 months ago

Because I've been using this feature for half a year, I'll merge it first. Perhaps I will find time over the weekend to add more documentation.

cc @megalithic @jfpedroza