|
| 1 | +return { |
| 2 | + { |
| 3 | + 'nvim-neotest/neotest', |
| 4 | + dependencies = { |
| 5 | + 'nvim-neotest/nvim-nio', |
| 6 | + 'nvim-lua/plenary.nvim', |
| 7 | + 'antoinemadec/FixCursorHold.nvim', |
| 8 | + 'nvim-treesitter/nvim-treesitter', |
| 9 | + 'nvim-neotest/neotest-jest', |
| 10 | + }, |
| 11 | + config = function() |
| 12 | + local neotest = require 'neotest' |
| 13 | + |
| 14 | + neotest.setup { |
| 15 | + adapters = { |
| 16 | + require 'neotest-jest', |
| 17 | + }, |
| 18 | + } |
| 19 | + |
| 20 | + -- Set up keybindings |
| 21 | + local map = vim.keymap.set |
| 22 | + local opts = { noremap = true, silent = true } |
| 23 | + |
| 24 | + map('n', '<leader>tt', function() |
| 25 | + neotest.run.run() |
| 26 | + end, opts) -- Run nearest test |
| 27 | + map('n', '<leader>tf', function() |
| 28 | + neotest.run.run(vim.fn.expand '%') |
| 29 | + end, opts) -- Run current file |
| 30 | + map('n', '<leader>td', function() |
| 31 | + neotest.run.run { strategy = 'dap' } |
| 32 | + end, opts) -- Run with debugger |
| 33 | + map('n', '<leader>to', function() |
| 34 | + neotest.output.open() |
| 35 | + end, opts) |
| 36 | + end, |
| 37 | + }, |
| 38 | +} |
0 commit comments