You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

  1. return {
  2. "nvim-neotest/neotest",
  3. dependencies = {
  4. "nvim-lua/plenary.nvim",
  5. "nvim-treesitter/nvim-treesitter",
  6. "antoinemadec/FixCursorHold.nvim",
  7. "nvim-neotest/nvim-nio",
  8. -- Adapters
  9. "tovijaeschke/neotest-phpunit",
  10. "nvim-neotest/neotest-go",
  11. },
  12. config = function()
  13. local neotest = require("neotest")
  14. local keymap = vim.keymap
  15. keymap.set("n", "<leader>tr", function()
  16. neotest.run.run()
  17. end, { desc = "Run neotest on current function" })
  18. keymap.set("n", "<leader>tR", function()
  19. neotest.run.run_last()
  20. end, { desc = "Run neotest on most recent test" })
  21. keymap.set("n", "<leader>tS", function()
  22. neotest.run.stop()
  23. end, { desc = "Stop running tests" })
  24. keymap.set("n", "<leader>ta", function()
  25. neotest.run.attach()
  26. end, { desc = "Attach to the currently running test" })
  27. keymap.set("n", "<leader>to", function()
  28. neotest.output.open()
  29. end, { desc = "Open the output of the test" })
  30. keymap.set("n", "<leader>ts", function()
  31. neotest.summary.toggle()
  32. end, { desc = "Toggle neotest summary pane" })
  33. neotest.setup({
  34. adapters = {
  35. require("neotest-phpunit")({
  36. root_files = { "phpunit.xml", "composer.json" },
  37. -- phpunit_cmd = { "docker", "compose", "exec", "fpm", "./vendor/bin/phpunit" },
  38. phpunit_cmd = { "docker", "compose", "exec", "app-fpm", "./vendor/bin/phpunit" },
  39. filter_dirs = { "vendor" },
  40. mapped_docker_dir = "/var/www",
  41. append_to_cwd = "/api",
  42. }),
  43. },
  44. })
  45. end,
  46. }