{ lib, config, pkgs, ... }: { # TODO: Refactor this as neotest is supported on nixvim now options = { neotest.enable = lib.mkEnableOption "Enable neotest module"; }; config = lib.mkIf config.neotest.enable { extraPlugins = with pkgs.vimPlugins; [ # (pkgs.vimUtils.buildVimPlugin { # pname = "neotest-java"; # version = "v0.17.6"; # src = pkgs.fetchFromGitHub { # owner = "rcasia"; # repo = "neotest-java"; # rev = "43b4cf9ee0d3d05f56a9a43c89c4268157cfbc79"; # sha256 = "0653fx7bcr8mn38dfza4qywia1i862zc42frwf18s51zp5jjrfqy"; # }; # }) (pkgs.vimUtils.buildVimPlugin { pname = "neotest-vim-test"; version = "2023-04-17"; src = pkgs.fetchFromGitHub { owner = "nvim-neotest"; repo = "neotest-vim-test"; rev = "75c4228882ae4883b11bfce9b8383e637eb44192"; sha256 = "12ix1lzmqlk3iyngaafby9c02fcl9d5iva965miwxfljvmibjnbw"; }; }) neotest FixCursorHold-nvim neotest-plenary vim-test neotest-python neotest-vitest ]; extraConfigLua = '' require("neotest").setup({ adapters = { -- require("neotest-java")({ -- ignore_wrapper = false, -- -- function to determine which runner to use based on project path -- determine_runner = function(project_root_path) -- -- return should be "maven" or "gradle" -- return "maven" -- end, -- -- override the builtin runner discovery behaviour to always use given -- -- tool. Default is "nil", so no override -- force_runner = nil, -- -- if the automatic runner discovery can't uniquely determine whether -- -- to use Gradle or Maven, fallback to using this runner. Default is -- -- "maven" -- fallback_runner = "gradle" -- }), require("neotest-python")({ dap = { justMyCode = false }, }), require "neotest-vim-test" { ignore_file_types = { "python", "java", "vim", "lua", "javascript", "typescript" }, }, }, output = { enabled = true, open_on_run = true }, summary = { enabled = true, }, }) ''; keymaps = [ { mode = "n"; key = "tt"; action = "lua require('neotest').run.run(vim.fn.expand '%')"; options = { desc = "Run File"; silent = true; }; } { mode = "n"; key = "tT"; action = "lua require('neotest').run.run(vim.loop.cwd())"; options = { desc = "Run All Test Files"; silent = true; }; } { mode = "n"; key = "tr"; action = "lua require('neotest').run.run()"; options = { desc = "Run Nearest"; silent = true; }; } { mode = "n"; key = "td"; action = "lua require('neotest').run.run({strategy = 'dap'})"; options = { desc = "Run Nearest with debugger"; silent = true; }; } { mode = "n"; key = "ts"; action = "lua require('neotest').summary.toggle()"; options = { desc = "Toggle Summary"; silent = true; }; } { mode = "n"; key = "to"; action = "lua require('neotest').output.open{ enter = true, auto_close = true }"; options = { desc = "Show Output"; silent = true; }; } { mode = "n"; key = "tO"; action = "lua require('neotest').output_panel.toggle()"; options = { desc = "Toggle Output Panel"; silent = true; }; } { mode = "n"; key = "tS"; action = "lua require('neotest').run.stop()"; options = { desc = "Stop"; silent = true; }; } ]; }; }