nvim-neotest / neotest

An extensible framework for interacting with tests within NeoVim.
MIT License
2.44k stars 123 forks source link

Run All? #28

Closed hahuang65 closed 2 years ago

hahuang65 commented 2 years ago

Is there a command to run the entire test suite of a project?

olimorris commented 2 years ago

I don't believe there is currently but I open the summary pane and press r at the top of the tree:

Screen Shot 2022-06-15 at 10 58 45

stevearc commented 2 years ago

You can get a similar effect by passing a directory in to the run command

require("neotest").run.run(vim.fn.getcwd())
hahuang65 commented 2 years ago

Thanks @stevearc your suggestion works pretty well in most cases!

rcarriga commented 2 years ago

Yeah I've always just used getcwd() but I can see how that wouldn't work all the time. Not sure of what a nice interface would be. Simple solution I think would have a function to get the root directory and then supply that to the run function. E.g. neotest.run.run(neotest.run.root()) though if there's a way to extend the current run args to say "run everything" then I'd prefer that, so open to ideas

rcarriga commented 2 years ago

OK I've added a suite arg to neotest.run.run, so just set { suite = true } in the args :smile:

The root() function would have required users to wrap it in plenary's async library which would be a pain

olimorris commented 2 years ago

@rcarriga testing this with multiple adapters in the same Neovim instance and it only runs tests for the first adapter.

rcarriga commented 2 years ago

That is intended behaviour. I've added neotest.run.adapters() to get the known adapter IDs.

      for _, adapter_id in ipairs(neotest.run.adapters()) do
        neotest.run.run({ suite = true, adapter = adapter_id })
      end