From a3b66e473e8a7ae08985ac162e870e5c3098c303 Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Sun, 24 Sep 2023 13:00:30 +0930 Subject: [PATCH] Fix neotest-phpunit and add some test keybinds --- .config/nvim/lua/config/neotest.lua | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.config/nvim/lua/config/neotest.lua b/.config/nvim/lua/config/neotest.lua index 5baa9d5..d8c24f0 100644 --- a/.config/nvim/lua/config/neotest.lua +++ b/.config/nvim/lua/config/neotest.lua @@ -1,16 +1,22 @@ -require("neotest").setup({ +local neotest = require('neotest') + +vim.keymap.set('n', 'tr', function () neotest.run.run() end) +vim.keymap.set('n', 'tR', function () neotest.run.run_last() end) +vim.keymap.set('n', 'tf', function () neotest.run.run(vim.fn.expand('%')) end) +vim.keymap.set('n', 'tS', function () neotest.run.stop() end) +vim.keymap.set('n', 'ta', function () neotest.run.attach() end) +vim.keymap.set('n', 'to', function () neotest.output.open() end) +vim.keymap.set('n', 'ts', function () neotest.summary.toggle() end) + +neotest.setup({ adapters = { require("neotest-phpunit")({ root_files = { "phpunit.xml", "composer.json" }, - phpunit_cmd = { "docker-compose exec fpm ./vendor/bin/phpunit" }, - filter_dirs = { "vendor" } + phpunit_cmd = { "docker-compose", "exec", "fpm", "./vendor/bin/phpunit" }, + filter_dirs = { "vendor" }, + mapped_docker_dir = "/var/www", + append_to_cwd = '/api' }), }, }) -require("neotest-phpunit")({ - root_files = { "phpunit.xml", "composer.json" }, - phpunit_cmd = { "docker-compose", "exec", "fpm", "./vendor/bin/phpunit" }, - -- phpunit_cmd = { "vendor/bin/phpunit" }, - filter_dirs = { "vendor" } -})