|
|
- return {
- "nvim-neotest/neotest",
- event = "VeryLazy",
- dependencies = {
- "nvim-lua/plenary.nvim",
- "nvim-treesitter/nvim-treesitter",
- "antoinemadec/FixCursorHold.nvim",
- "nvim-neotest/nvim-nio",
- -- Adapters
- "tovijaeschke/neotest-phpunit",
- "nvim-neotest/neotest-go",
- },
- config = function()
- local neotest = require("neotest")
-
- local keymap = vim.keymap
-
- keymap.set("n", "<leader>tr", function()
- neotest.run.run()
- end, { desc = "Run neotest on current function" })
-
- keymap.set("n", "<leader>tR", function()
- neotest.run.run_last()
- end, { desc = "Run neotest on most recent test" })
-
- keymap.set("n", "<leader>tS", function()
- neotest.run.stop()
- end, { desc = "Stop running tests" })
-
- keymap.set("n", "<leader>ta", function()
- neotest.run.attach()
- end, { desc = "Attach to the currently running test" })
-
- keymap.set("n", "<leader>to", function()
- neotest.output.open()
- end, { desc = "Open the output of the test" })
-
- keymap.set("n", "<leader>ts", function()
- neotest.summary.toggle()
- end, { desc = "Toggle neotest summary pane" })
-
- local neotest_ns = vim.api.nvim_create_namespace("neotest")
- vim.diagnostic.config({
- virtual_text = {
- format = function(diagnostic)
- local message =
- diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
- return message
- end,
- },
- }, neotest_ns)
-
- vim.env.PROJECT_ROOT = vim.fn.getcwd() .. "/backend/"
- vim.env.ENV_PATH = vim.fn.getcwd() .. "/backend/.env"
-
- neotest.setup({
- adapters = {
- require("neotest-phpunit")({
- root_files = { "phpunit.xml", "composer.json" },
- phpunit_cmd = { "docker", "compose", "exec", "fpm", "./vendor/bin/phpunit" },
- -- phpunit_cmd = { "docker", "compose", "exec", "app-fpm", "./vendor/bin/phpunit" },
- filter_dirs = { "vendor" },
- mapped_docker_dir = "/var/www",
- append_to_cwd = "/api",
- }),
- require("neotest-go")({
- root = function()
- return './backend'
- end,
- experimental = {
- test_table = true,
- },
- args = { "-count=1", "-timeout=60s" },
- })
- },
- })
- end,
- }
|